Tag: firebase notifications

当应用在后台运行时,Google Firebase远程通知不会popup

我正在使用Google Firebase向用户发送通知。 当时我试图发送通知单个设备(我的)。 遇到接收通知问题 – 而我的应用程序运行在后台横幅不会出现。 但是,如果我打开我的应用程序,方法didReceiveRemoteNotification:触发我的警报视图: – (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:userInfo[@"notification"][@"body"] message:@"More info…" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Open",nil]; [alert show]; } 但是,由于它是用Google Firebase文档编写的,因此在打开应用程序后会触发此方法,所以这是有道理的。 所以消息被传递到我的设备,我只是不能触发通知横幅,如果应用程序在后台。 我读了有关设置消息优先级为高和自定义数据密钥的内容 – 可用1,但没有运气。 我是否在代码中缺less其他内容来触发通知? 我已经使用Google Firebase指南来实现通知。

iOS:注册令牌无效。 检查令牌格式

我是Firebase以及iOS的新手。 我正尝试使用FCM发送推送通知。 我在FCM上注册了一个iOS应用程序。 两个.p12证书都添加了。 根据FCM开发的代码。 在通过Firebase控制台发送通知时,我收到错误的Invalid registration token. Check the token format. Invalid registration token. Check the token format. 。 我不知道我做了什么错误。

当应用程序处于后台iOS时的Firebase数据库事务

我正在使用交互式推送通知,当我回复PN时,应该更新firbase数据库。 它不能很好的工作,因为有些时候,如果应用程序在后台数据没有实时同步。 但是当你打开应用程序,它会推动数据 如果应用程序处于死亡状态,则答复甚至不会发送到Firebase数据库 Ref.child(uId).runTransactionBlock({ (currentData: FIRMutableData) -> FIRTransactionResult in var value = currentData.value as? [String : AnyObject] if value == nil { return FIRTransactionResult.success(withValue: currentData) } let totR = value!["totalReply"] as? Int ?? 0 print(totR) value?["totalReply"] = totR + 1 currentData.value = value }

当通知被点击时,如何在Swift 3中处理启动选项? 获取语​​法问题

我正在尝试处理启动选项,并打开一个特定的视图控制器,我点击一个远程通知,我收到了迅速3.我已经看到类似的问题,例如在这里 ,但没有为新的SWIFT 3实施。 我看到一个类似的问题(和)在AppDelegate.swift中,我有didFinishLaunchingWithOptions中的以下内容: var localNotif = (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey] as! String) if localNotif { var itemName = (localNotif.userInfo!["aps"] as! String) print("Custom: \(itemName)") } else { print("//////////////////////////") } 但Xcode给我这个错误: Type '[NSObject: AnyObject]?' has no subscript members 我也试过这个: if let launchOptions = launchOptions { var notificationPayload: NSDictionary = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey] as NSDictionary! } 我得到这个错误: error: ambiguous reference to member […]

Firebase(FCM)无法获取APNS令牌Error Domain = com.firebase.iid Code = 1001

我正在尝试使用FCM进行通知。 但是<FIRInstanceID/WARNING>无法获取APNS令牌Error Domain=com.firebase.iid Code=1001 "(null)"发生,所以我无法获取通知。 有什么问题? 在控制台, 无法获取APNS令牌Error Domain=com.firebase.iid Code=1001 "(null)" 下面是我在Appdelegate代码 import UIKit import CoreData import Alamofire import Firebase import FirebaseInstanceID import FirebaseMessaging @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? var badgeCount : Int = 0; enum BasicValidity : String { case Success = "basicInfo" case Fail = "OauthAuthentificationError" } func application(application: […]

Firebase云消息传递不会创build推送通知,但会获取信息

我正在通过本教程( https://www.youtube.com/watch?v=JsWHzU1DxjM )尝试将推送通知放到我的iOS应用程序中。 我能够成功获取APNS的证书,并设置“推送通知”和“后台模式”function。 此外,当我从Firebase控制台发送一条通知时,Firebase能够从通知中获取信息。 但是,当应用程序在后台运行时,横幅通知不会出现。 我觉得我可能有一个问题转换从Objective-C到Swift的教程,因为该教程是在Objective-C,但我不知道。 如果有帮助,我把我的AppDelegate类和程序输出。 @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { connectToFcm() NSNotificationCenter.defaultCenter().addObserver( self, selector: #selector(tokenRefreshCallback), name: kFIRInstanceIDTokenRefreshNotification, object: nil) let allNotificationTypes = UIUserNotificationType(arrayLiteral: UIUserNotificationType.Sound, UIUserNotificationType.Alert, UIUserNotificationType.Badge) let settings = UIUserNotificationSettings(forTypes: allNotificationTypes, categories: nil) application.registerUserNotificationSettings(settings) application.registerForRemoteNotifications() return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: […]

当App在iOS 10的后台时,推送通知不会被收到

我正在使用FCM(Firebase云消息传递)在iOS中发送推送通知。 当App处于前台状态时,我可以收到通知。 但是当应用程序处于后台状态时,不会收到通知。 每当应用程序将进入前台状态,才会收到通知。 我的代码是: – (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler { // Print message ID. NSDictionary *userInfo = notification.request.content.userInfo; NSLog(@"Message ID: %@", userInfo[@"gcm.message_id"]); // Pring full message. NSLog(@"%@", userInfo); if( [UIApplication sharedApplication].applicationState == UIApplicationStateInactive ) { NSLog( @"INACTIVE" ); completionHandler(UNNotificationPresentationOptionAlert); } else if( [UIApplication sharedApplication].applicationState == UIApplicationStateBackground ) { NSLog( @"BACKGROUND" ); completionHandler( […]

通过服务器端代码的Firebase通知

新的Firebase通知服务允许我们使用控制台用户界面向所有移动应用用户发送通知。 但是我找不到任何适用于Firebase通知服务的REST API。 我想通过基于事件的服务器端代码自动发送通知给移动用户。 Firebase通知服务是否具有可通过HTTP / S访问的API?

APNS Firebase通知无法获取令牌

对于Swift3 / iOS10,请看这个链接: ios10,Swift 3和Firebase推送通知(FCM) 我正在尝试使用Firebase for Notifications,并按照文档中的说明完全整合。 但我不明白为什么不行。 当我build立我的项目,我看到这一行: 2016-05-25 16:09:34.987: <FIRInstanceID/WARNING> Failed to fetch default token Error Domain=com.firebase.iid Code=0 "(null)" 这个我的AppDelegate: func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { FIRApp.configure() FIRDatabase.database().persistenceEnabled = true var service: DataService = DataService() service.start() registerForPushNotifications(application) application.registerForRemoteNotifications() return true } func registerForPushNotifications(application: UIApplication) { let notificationSettings = […]

Firebase聊天推送通知

我正在开发一个使用Firebase作为后端的聊天应用程序。 要求在每一个新的消息接收者得到一个推送通知,说他得到了一个新的消息。 这是我第一次做这样的事情,所以我有一个问题: 由于我们没有使用我们自己的服务器,我们是否需要第三方提供者(例如批处理)来处理推送通知? 如果我没有弄错,我想Firebase不支持发送像这样的推送通知,但只支持从控制台发送的通知。 任何帮助将是伟大的。