2017-09-24 103 views
0

我跟着火力网站上的文档指南,做了以下所有的东西:火力地堡云消息(FCM)不工作

实现的代码AppDelegate.swift。

2.将豆荚添加到我的豆荚文件并安装。在Certifictes

创建APN认证密钥,标识符在我developer.apple帐户& 型材并在FCM设置粘贴。

4.在项目功能中启用了推送通知(已勾选两项v)。

5.创建的证书类型:苹果推送服务生产

我送情侣的通知,从火力控制台,并在我的iPhone(IOS 10.3)并没有收到任何。 任何提示要检查什么?我错过了什么?


Podfile

use_frameworks! 

    # Pods for App 
    pod 'Firebase/Core' 
    pod 'Firebase/Crash' 
    pod 'Firebase/Messaging' 

AppDelegate.swift

import UIKit 
import Firebase 
import UserNotifications 

@UIApplicationMain 
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate { 

var window: UIWindow? 

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
     // Override point for customization after application launch. 

     // Use Firebase library to configure APIs. 
     FirebaseApp.configure() 

     if #available(iOS 10.0, *) { 
      // For iOS 10 display notification (sent via APNS) 
      UNUserNotificationCenter.current().delegate = self 

      let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound] 
      UNUserNotificationCenter.current().requestAuthorization(
       options: authOptions, 
       completionHandler: {_, _ in }) 
     } else { 
      let settings: UIUserNotificationSettings = 
       UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil) 
      application.registerUserNotificationSettings(settings) 
     } 

     application.registerForRemoteNotifications() 


     return true 
    } 
+0

也许你可以与苹果推送服务的开发尝试,而不是生产,因为我认为你在调试模式下测试应用程序,而不是特别版本。 –

+0

其实我发现了生产中的问题。我应该启用后台模式远程通知吗? – LamaTo

+1

你不需要。我收到未启用后台模式远程通知的推送通知。仅当您需要无声通知时才使用后台模式远程通知。 –

回答

0

必须添加一些方法。

只是this one :)

比较你AppDelegate.swift这是从火力,球员的“官方”样品(我是这么认为的:d)