Tag: 推送通知

使用Firebase发送和接收iOS应用的推送通知

我为iOS创build了基于Firebase的聊天应用程序。 其中一项function是向同一个聊天室中的用户发送推送通知(如果他们不在线)。 我无法find可用于向用户发送推送通知的Firebasefunction(适用于iOS)。 可能吗?

尝试将设备注册到Bluemix上的IBM Mobile First Push服务时,iOS应用程序崩溃

我有一个运行在iPad mini 4(iOS 9.0.2)上的iOS 9应用程序。 尝试将设备注册到Bluemix上的我的IMFPush服务实例时,它崩溃。 以下是在我的App委托中执行注册的代码: func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Push notifications let notificationTypes: UIUserNotificationType = [UIUserNotificationType.Badge, UIUserNotificationType.Alert, UIUserNotificationType.Sound] let notificationSettings: UIUserNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil) application.registerUserNotificationSettings(notificationSettings) application.registerForRemoteNotifications() return true } func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) { // Initialize the Mobile First SDK with IBM […]

如何在iOS(ObjC)中安排每日本地推送通知?

无法以正确的方式安排每日本地PushNotification 。 我想在上午9:00只显示一个每日本地推送通知,并计算今天的任务。 我的代码在didFinishLaunchingWithOptions只执行一次,如: – (void)scheduleLocalNotification { self.localNotification = [UILocalNotification new]; unsigned unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay; NSCalendar *calendar = [NSCalendar currentCalendar]; NSDateComponents *components = [calendar components:unitFlags fromDate:[NSDate date]]; components.hour = 9; components.minute = 0; components.second = 0; NSDate *fireTime = [calendar dateFromComponents:components]; _localNotification.fireDate = fireTime; _localNotification.alertBody = [NSString stringWithFormat:@"Hi, <username>. You have […]

使用Firebase Cloud Messaging安排推送通知

我正在将推送通知集成到正在开发的应用中。 我已select使用Firebase云消息传递(FCM)来支持Android和iOS。 当使用控制台发送推送消息时,我发现有一个选项可以延迟推送通知的实际发送。 但是,当检查HTTP文档,我似乎无法find这个选项。 如何安排通知,以便稍后使用FCM和HTTP API发送通知?

IBM Worklight – 无法使用现有别名注册到事件源callback。 别名已经被用于事件源

我正在使用IBM Worklight 6.0.0并在iOS 7设备上进行testing。 我有以下js错误: Cannot register to event source callback with an existing alias: 'myPush'. The alias is already in use for event source 'PushEventSource'. 在设备上,当我login,注销然后再次login。 (第二次出现错误) 在客户端,我的代码是: if (WL.Client.Push){ WL.Client.Push.onReadyToSubscribe = function(){ WL.Logger.debug("onReadyToSubscribe"); WL.Client.Push.registerEventSourceCallback( "myPush", "PushAdapter", "PushEventSource", pushNotificationReceived); if (isPushSubscribed() == false) { doSubscribe(); } }; } 我的代码有什么问题吗? 是否因为我应该只调用一次“WL.Client.Push.registerEventSourceCallback”? 任何其他解决scheme

parsing推送通知iOS

我在Parse.com上完成了推送工作(它正在工作,所有),然后我被要求为公司创build一个parsing帐户,并设置它们,以便他们可以自己pipe理它。 好吧,没有意识到网站上有一个导出button,我删除了我的帐户上的应用程序,并为他们创build一个帐户,并将应用程序添加到他们的帐户。 我添加了所有正确的证书并更新了应用程序和客户端密钥,它不会发送它,并在推送通知选项卡上,它会显示我有收件人(我的testing设备),但是当我点击发送,它会说完成,但是我的设备上不会显示任何内容。 所以,不是太聪明,我删除了该应用程序,并在我的帐户重新创build(认为可能有错误的其他帐户)。 那么现在它甚至不会在我的帐户上工作。 我已经创build了所有新的证书和一切,我不明白为什么它不工作。再次,在推送通知选项卡上,它会显示我有收件人(我的testing设备),但是当我点击发送,它会说完成,但没有任何东西会出现在我的设备上。 帮帮我? 我想到的可能是设备正在记住旧帐户的APNS权限,我可以对吗?

Pushsharp apple通知调用SSPI失败错误

我使用PushSharp在C#中发送Apple推送通知,我有我的生产.pem文件及其密码。 下面是我的代码片段。总是得到这个错误.. "A call to SSPI failed, see inner exception. —> System.ComponentModel.Win32Exception: The message received was unexpected or badly formatted-" 要么 "System.IO.IOException: Authentication failed because the remote party has closed the transport stream." 我尝试了几乎所有可用的代码在net.Even尝试MoonAPNS但同样的错误,对于自定义脚本也得到这个SSPI失败错误。 我使用相同的.pem文件,并运行一个PHP脚本发送推送通知到同一台服务器的APN,它的工作原理。 var push = new PushBroker(); var appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ck.pem")); push.RegisterAppleService(new ApplePushChannelSettings(false, appleCert, "pwd")); push.QueueNotification(new AppleNotification() .ForDeviceToken("XXXXXXXXXXXXXXX") .WithAlert("Hello World!") .WithBadge(7) […]

iOS在播放应用程序时收到推送通知时播放声音

如何在前台应用程序接收推送通知时播放声音。 我的代码: – (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { if (application.applicationState == UIApplicationStateActive) { //create an audio player and play the sound NSString *path = [[NSBundle mainBundle] pathForResource:@"whistle" ofType:@"caf"]; NSURL *fileURL = [[NSURL alloc] initFileURLWithPath: path]; AVAudioPlayer *theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:NULL]; theAudio.volume = 1.0; [theAudio prepareToPlay]; [theAudio play]; } NSLog(@"didReceiveRemoteNotification %@",userInfo); }

推送通知委托回叫没有被调用

我正在通过调用以下代码注册推送通知: [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound]; 但在一些极less数情况下,委托没有被调用: – (void)application:(UIApplication *)iApplication didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)iNewDeviceToken { 甚至没有被调用的方法: – (void)application:(UIApplication *)iApplication didFailToRegisterForRemoteNotificationsWithError:(NSError *)iError { 这可能是什么原因。 一旦我收到设备令牌,我将继续使用我的应用程序stream程。 所以,在一些罕见的情况下我的应用程序hungs。 任何线索?

Swift:'(NSObject,AnyObject)'没有一个名为'subscript'的成员

我试图从远程通知的userInfo字典中提取徽章值。 我读了很多post,发现了我的问题的解决scheme,但我很不满意! 所以这里是我的数据结构(我删除了无用的行): { aps = { badge = 7 } } 为了从我的userInfo提取这个数字'7',我想要做到以下几点: self.updateAppIcon(userInfo["aps"]["badge"] as? Int) 但是,我当然得到以下错误: Swift:'(NSObject,AnyObject)'没有一个名为'subscript'的成员 如果我没有错,那是因为[]返回一个不能被解释为另一个字典的AnyObject。 一个工作解决scheme将是做到以下几点: func handleRemoteNotifiation(userInfo: [NSObject : AnyObject]) { if let aps: AnyObject = userInfo["aps"] { if let apsDict = aps as? [String : AnyObject]{ if let badge: AnyObject = apsDict["badge"] { self.updateAppIconBadgeNumber(badge as? Int) } } } […]