APNS:无效令牌 (8) [英] APNS: invalid token (8)

查看:21
本文介绍了APNS:无效令牌 (8)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 https://code.google.com/提供的 apns php 服务器p/apns-php/.

我已经设置了推送通知证书,但我的代码仍然在连接时引发错误.

I've have set up th push notification certificate but my code still throws an error on connect.

这有什么问题吗?这是我获取设备令牌的方法:

What is wrong with this? Here is how I get the device token:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken {

#if !TARGET_IPHONE_SIMULATOR

    // Prepare the Device Token for Registration (remove spaces and < >)
    NSString *deviceToken = [[[[devToken description]
                               stringByReplacingOccurrencesOfString:@"<"withString:@""]
                              stringByReplacingOccurrencesOfString:@">" withString:@""]
                             stringByReplacingOccurrencesOfString: @" " withString: @""];
    NSLog(@"%@", deviceToken);

#endif
}

这是我运行服务器时的错误:

This is the error when I run my server:

Sat, 11 May 2013 13:37:53 -0700 ApnsPHP[18198]: INFO: Trying 
ssl://gateway.push.apple.com:2195...
Sat, 11 May 2013 13:37:54 -0700 ApnsPHP[18198]: INFO: Connected to ssl://gateway.push.apple.com:2195.
Sat, 11 May 2013 13:37:54 -0700 ApnsPHP[18198]: INFO: Sending messages queue, run #1: 1 message(s) left in queue.
Sat, 11 May 2013 13:37:54 -0700 ApnsPHP[18198]: STATUS: Sending message ID 1 [custom identifier: abc123] (1/3): 101 bytes.
Sat, 11 May 2013 13:37:54 -0700 ApnsPHP[18198]: ERROR: Unable to send message ID 1: Invalid token (8).
Sat, 11 May 2013 13:37:54 -0700 ApnsPHP[18198]: INFO: Disconnected.
Sat, 11 May 2013 13:37:54 -0700 ApnsPHP[18198]: INFO: Trying ssl://gateway.push.apple.com:2195...
Sat, 11 May 2013 13:37:54 -0700 ApnsPHP[18198]: INFO: Connected to ssl://gateway.push.apple.com:2195.
Sat, 11 May 2013 13:37:54 -0700 ApnsPHP[18198]: INFO: Sending messages queue, run #2: 1 message(s) left in queue.
Sat, 11 May 2013 13:37:54 -0700 ApnsPHP[18198]: WARNING: Message ID 1 [custom identifier: abc123] has an unrecoverable error (8), removing from queue without retrying...
Sat, 11 May 2013 13:37:55 -0700 ApnsPHP[18198]: INFO: Disconnected.

推荐答案

最可能的解释是您正在向生产 APNS 服务器发送带有沙盒设备令牌的推送通知.

The most likely explanation is that you are sending a push notification with a sandbox device token to the production APNS server.

您使用的是在沙盒环境中测试时由您的应用发送到您服务器的旧设备令牌,或者您的应用仍然使用开发配置文件进行签名,并且仍然从以下位置接收沙盒设备令牌APNS 服务.

Either you are using an old device token that was sent to your server by your app while you were testing it in the sandbox environment, or your app is still signed with a development provisioning profile, and is still receiving sandbox device tokens from the APNS service.

我的回答假设您使用的是源自 APN 服务的设备令牌,而不是您自己创建的一些虚拟令牌.

My answer assumes that you are using a device token that originated from the APN service, and not some dummy token you created yourself .

我建议您检查配置文件以查看为 aps 权利显示的值.我还建议您从任何旧设备令牌中清除您的数据库.

I suggest you check the provisioning profile to see what value appear for the aps entitlement. I also suggest you clear your db from any old device tokens.

这篇关于APNS:无效令牌 (8)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆