2017-11-07 7 views
1

こんにちは、私はGoogleのfirebaseプッシュ通知を実装し、トピックに登録しようとしています。FCM topic:000000005eb68872 with token:(null)

プッシュ通知を受け取ることはできますが、topic.Errorにはサブスクライブしていません。Cannot subscribe to topic: 000000005eb68872 with token: (null)がありますが、既にトークンが生成されています。

私は

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 

    UINavigationBar.appearance().isTranslucent = true 



/************************ FireBase Notification ************************************************************************/ 
    FirebaseApp.configure() 
    if #available(iOS 10.0, *) { 
     UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate 
     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() 

    let token = Messaging.messaging().fcmToken 
    print("********* FCM token: \(token ?? "") *************") 

    hubId = (isKeyPresentInUserDefaults(key: "hubID")) ? (UserDefaults.standard.value(forKey: "hubID") as? String)! : "NohubId" 
    Messaging.messaging().subscribe(toTopic: hubId) 

/************************ FireBase Notification ************************************************************************/ 

    return true 
} 

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { 
    Messaging.messaging().apnsToken = deviceToken 
} 

// Push Notification Methods 
func messaging(_ messaging: Messaging, didRefreshRegistrationToken fcmToken: String) { 
    print("Firebase registration token: \(fcmToken)") 
} 

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) { 
    print(userInfo) 
} 

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], 
       fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { 
    print(userInfo) 
    let aps = userInfo["aps"] as! NSDictionary 
    print(aps["alert"] as? String ?? "") 
    completionHandler(UIBackgroundFetchResult.newData) 
} 

エラー・スタック

AppDelegate

ポッド

target 'VQ Smart Home' do 
    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 
    use_frameworks! 

    # Pods for VQ Smart Home 
    pod 'SwiftyJSON' 
    pod 'NVActivityIndicatorView' 
    pod 'Firebase/Core', '4.0.4' 
    pod 'Firebase/Database', '4.0.4' 
    pod 'Firebase/Messaging', '4.0.4' 
    pod 'FirebaseInstanceID', '2.0.0' 
end 

ファイルIOS 11とXcode 9.0を使用しています

[1022:258833] [Firebase/Analytics][I-ACS003016] Firebase Analytics App Delegate Proxy is disabled. To log deep link campaigns manually, 

FIRAnalytics + AppDelegate.hのメソッドを呼び出します。 [1022] [Firebase/Analytics] [I-ACS003016] Firebase Analytics App Delegate Proxyが無効になっています。ディープリンクキャンペーン を手動でログに記録するには、FIRAnalytics + AppDelegate.hのメソッドを呼び出します。 ********* FCMトークン:dLdjXagKJpA:[MC]レイジーはNSBundle MobileCoreServicesをロード:APA91bH500MivUUFRUl-1mgqn7qrzp6lVG2divijtBR9RYBgQu4slIBE8W7FN_3VtM_lbyE7S-xcgK40dzrlw2h4fz0SzDrfyPF90KIrUUqE9qNDwOGGrtOLemV1qC1wcrdL2L4aB1Ro


[1022:258837] [BoringSSL] Function boringssl_context_get_peer_sct_list: line 1754 received sct extension 

長 [258810 1022] SCTデータ長未満であります[I-FCM002010]トークン付きトピック:000000005eb68872にサブスクライブできません:(null) [1022:258810] [ファイアベース/メッセージング] [I- FCM002010] MC] systemgroup.com.apple.configurationのシステムグループコンテナプロフィールパスは /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles [Fire-Base/Messaging] [I-FCM002010]トピックを購読できません:000000005eb68872 token:(null) [1022: 258838] [Firebase/Analytics] [I-ACS005000] AdSupport Frameworkは現在リンクされていません。一部の機能は正しく機能しません 。詳細はhttp:// ] [Firebase/Analytics] [I-ACS005000] AdSupport Frameworkは現在リンクされていません。一部の機能は正しく機能しません 。 HTTPで詳細をご覧ください:// [1022:258810] refreshPreferences:HangTracerEnabled:0 [1022:258810] refreshPreferences:HangTracerDuration:500 [1022:258810] refreshPreferences:ActivationLoggingEnabled:0 ActivationLoggingTaskedOffByDA:0 [1022:258832] [ Firebase/Analytics] [I-ACS023008] Firebase Analytics v.40002000が起動しました[Firebase/Analytics] [I-ACS023008] Firebase Analytics v.40002000が起動しました [1022:258832]デバッグログを有効にするには、次のアプリケーション引数を設定します。 -FIRAnalyticsDebugEnabled(参照) [102] 2:258839] [Firebase/Analytics] [I-ACS032003] iAdフレームワークはリンクされていません。検索広告アトリビューションレポーターが無効になっています。 ] [Firebase/Analytics] [I-ACS032003] iAdフレームワークはリンクされていません。検索広告アトリビューションレポーターが無効になっています。 [Firebase/Analytics] [I-ACS023012] Firebase Analytics有効化 [Firebase/Analytics] [I-ACS023012] Firebase Analytics有効 [1022:258833] TIC読み取りステータス[1:0x0]:1 :57 [1022:258833] TIC読み取りステータス[1:0x0の]:1:57

誰かが

答えて

0

は私がしようとしていたソリューション

を発見。これTNXを修正するために私を助けることができますdidFinishLaunchingWithOptionsでトピックを購読するが、すべての必要なメソッドとモジュールこの間にロードされません。だから、didRegisterForRemoteNotificationsWithDeviceTokenの中でサブスクリプションコードを動かしたところ、正常に動作しました。

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { 
     Messaging.messaging().apnsToken = deviceToken 
     Messaging.messaging().subscribe(toTopic: hubId) 
    } 
関連する問題