1

私は通知付きでアプリを作成しました。開発者モードで通知を送信すると通知が届きます。しかし、私がリリースモードで送信するとき、私は何も得られません。私は製品証明書に証明書を変更すべきであることを読んでいます。しかし、それは助けにはならない。ここに私のappdelegateがある:ちょうどこの通り抜けたFirefire通知がTestflightで動作しない

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


    FIRApp.configure() 

    let notificationTypes : UIUserNotificationType = [.alert, .badge, .sound] 
    let notificationSettings : UIUserNotificationSettings = UIUserNotificationSettings(types: notificationTypes, categories: nil) 
    application.registerForRemoteNotifications() 
    application.registerUserNotificationSettings(notificationSettings) 

    return true 
} 

private func application(application: UIApplication, didRegisterUserNotificationSettings notificationSettings: UIUserNotificationSettings) { 
    FIRMessaging.messaging().subscribe(toTopic: "/topics/main") 
} 

private func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) 
{ 
    FIRInstanceID.instanceID().setAPNSToken(deviceToken as Data, type: FIRInstanceIDAPNSTokenType.prod) 
} 

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { 
    print(userInfo["gcm.message_id"]!) 
    print(userInfo) 
} 

func application(_ application: UIApplication, dirtings: UIUserNotificationSettings) 
{ 
    UIApplication.shared.registerForRemoteNotifications() 
} 

func tokenRefreshNotification(notification: NSNotification) { 
    if let refreshedToken = FIRInstanceID.instanceID().token() { 
     print("InstanceID token: \(refreshedToken)") 
    } 

    // Connect to FCM since connection may have failed when attempted before having a token. 
    connectToFcm() 
} 



func connectToFcm() { 
    FIRMessaging.messaging().connect { (error) in 
     if (error != nil) { 
      print("Unable to connect with FCM. \(error)") 
     } else { 
      print("Connected to FCM.") 
     } 
    } 
} 

private func applicationDidEnterBackground(application: UIApplication) { 
    FIRMessaging.messaging().disconnect() 
    print("Disconnected from FCM.") 
} 
+1

あなたは 'kGGLInstanceIDAPNSServerTypeSandboxOption:@NO};'を設定しましたか?ここで行われたように:http://stackoverflow.com/q/37628158/4625829? –

+0

いいえ、私は思います。 :/私はそれを試し、できるだけ早く返信します。 – MRustamzade

+0

は機能しません。 :/私はgcmではなくfcmを使っています。 – MRustamzade

答えて

1

は私がオフにプッシュなって、リンゴのdevの中心から本命を削除し、すべての上にそれらを再度作成し、それが必要として、これは、すべての作業を行いました。

また、私はアプリストアにプッシュするとき、私は.prodに変更します、

FIRInstanceID.instanceID().setAPNSToken(deviceToken as Data, type: FIRInstanceIDAPNSTokenType.sandbox) 

をに設定するコード行を持っていました。

0

解決策が見つかりました。問題は証明された証明書であった。私はfirebaseにprod cetificateを追加することを忘れてしまいます。

関連する問題