2016-08-05 65 views
1

我在拥有工作推送通知的appstore中有一个应用程序。我创建了一个新的应用程序,并试图使用相同的应用程序ID来获取通知。我确定我的包标识符与旧应用程序相匹配,推送通知已启用,并且didRegisterForRemoteNotificationsWithDeviceToken正在获取令牌。我的服务器正在向苹果的APNS服务发送应用程序,但是从不会调用ReceiveRemoteNotification。我正在使用部署构建来测试它。推送通知适用于旧应用程序,但不适用于新应用程序

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) 

}

enter image description here

+0

应用程序处于死亡状态并且您看到横幅时,应用程序是否会收到推送? – Shubhank

+0

我已经尝试过在后台和前台应用程序,它不发送。我的应用必须运行才能触发服务器发送推送请求 – user1079052

+0

为什么需要运行? – Shubhank

回答

0

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

相关问题