【问题标题】:Push notifications working for old application but not on the new one推送通知适用于旧应用程序但不适用于新应用程序
【发布时间】:2016-08-05 14:51:05
【问题描述】:

我在应用商店中有一个具有有效推送通知的应用程序。我创建了一个新应用程序,并尝试使用相同的应用程序 ID 使通知正常工作。我确保我的包标识符与旧应用程序匹配,启用推送通知并且 didRegisterForRemoteNotificationsWithDeviceToken 正在获取令牌。我的服务器正在将应用程序发送到 Apple 的 APNS 服务,但从未调用过 didReceiveRemoteNotification。我正在使用部署版本对此进行测试。

 func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {

    print("Failed to register:", error)


func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
   processPushMessage(userInfo)
    print("recieved alert :\(userInfo)");

}


func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {

    profile.reset()
    getObjects()

     print("didRegisterForRemoteNotificationsWithDeviceToken")

    let tokenChars = UnsafePointer<CChar>(deviceToken.bytes)
    var tokenString = ""

    for i in 0..<deviceToken.length {
        tokenString += String(format: "%02.2hhx", arguments: [tokenChars[i]])
    }



    print("Device Token:", tokenString)

}

【问题讨论】:

  • 当应用处于终止状态并且您看到横幅时,应用是否会收到推送?
  • 我已经在后台和前台尝试了该应用程序,但它没有发送。我的应用程序必须运行才能触发服务器发送推送
  • 为什么需要运行?
  • 它是在连接 Asterisk 呼叫时发送的,所以我需要打开它来连接呼叫。
  • 我建议只是尝试使用github.com/noodlewerk/NWPusher 发送一个简单的推送,应用程序被杀死,如果收到调试为什么你没有在前台推送。否则,调试你的配置和证书,看看为什么你根本没有收到推送

标签: ios iphone swift push-notification


【解决方案1】:

您是否已吊销您的证书。即使您的临时个人资料变得无效或无效,您也不会收到通知。在您的开发者门户中检查该配置文件是否处于活动状态(无效)。

【讨论】:

    猜你喜欢
    • 2019-12-16
    • 2011-07-08
    • 2021-06-08
    • 1970-01-01
    • 1970-01-01
    • 2021-04-10
    • 2022-08-04
    • 2016-06-23
    • 1970-01-01
    相关资源
    最近更新 更多