0
我遵循Google Firebase中的規則來配置我的iOS應用。當我給它從未被使用過的火力地堡控制檯設備ID(標記),該通知是由我的應用程序捕獲,但用戶信息爲空:Firebase消息iOS:usersInfo爲空或我從未收到通知
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject],
fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
// If you are receiving a notification message while your app is in the background,
// this callback will not be fired till the user taps on the notification launching the application.
// TODO: Handle data of notification
// Print message ID.
print("Message ID: \(userInfo["gcm.message_id"]!)") /* HERE */
// Print full message.
print("%@", userInfo)
}
在與/* HERE */
評論,應用程序行由於userInfo是nil
而崩潰。
當我再次嘗試從Firebase控制檯發出另一個通知時,通知未被捕獲並且沒有附加任何內容(我在接收通知功能中有一個斷點)。
怎麼了?