【问题标题】:Push notifications doesn't work on TestFlight推送通知在 TestFlight 上不起作用
【发布时间】:2017-01-17 20:55:16
【问题描述】:

我使用 Firebase 发送通知:

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {            
        FIRApp.configure()            
        let notificationTypes: UIUserNotificationType = [UIUserNotificationType.alert, UIUserNotificationType.badge, UIUserNotificationType.sound]
        let pushNotificationSettings = UIUserNotificationSettings(types: notificationTypes, categories: nil)            
        application.registerUserNotificationSettings(pushNotificationSettings)
        application.registerForRemoteNotifications()            
        UIApplication.shared.applicationIconBadgeNumber = 0

        return true
    }        

    func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {            
        print("MessageID : \(userInfo["gcm_message_id"]!)")
        print (userInfo)
    }

    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {            
        FIRInstanceID.instanceID().setAPNSToken(deviceToken, type:FIRInstanceIDAPNSTokenType.sandbox)
        FIRInstanceID.instanceID().setAPNSToken(deviceToken, type:FIRInstanceIDAPNSTokenType.prod)            
    }

我在 Firebase 上上传了两个证书:“APNs Development iOS”作为开发证书。和“Apple Push Services”作为分发(生产)证书:

我在开发模式下收到通知,但在 TestFlight 下载我的应用时没有收到通知。

【问题讨论】:

  • 如果您使用的是 TestFlight,我假设它是 AdHoc 构建? AdHoc 构建使用生产 APNS 环境 - Firebase 是否有权访问您的生产 APNS 推送通知证书?
  • 不,我将新版本上传到 App Store 并在外部测试中添加了我的电子邮件。我还在 Firebase 上上传了分发证书
  • 发行证书是什么意思? APNS证书/p12/pem呢?
  • 我在 Firebase 上上传了“APNs Development iOS”证书和“Apple Push Services”证书。我附上截图:i.imgsafe.org/e931d227ff.png
  • 如果你上传到应用商店,并使用开发证书,那是行不通的。应用商店构建使用生产环境,因此需要生产证书。

标签: ios swift firebase firebase-cloud-messaging testflight


【解决方案1】:

我删除了证书并创建了新证书并再次上传。现在可以了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-16
    • 1970-01-01
    • 2014-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多