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

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

问题描述

我用这APNS PHP服务器: HTTPS://$c$c.google.com/ p / APNS的PHP / 。我已经做了所有生产证书不错。有什么不对呢?这里是我得到设备令牌:

   - (无效)应用:(*的UIApplication)的应用didRegisterForRemoteNotificationsWithDeviceToken:(NSData的*){DEVTOKEN#如果!TARGET_IPHONE_SIMULATOR    // prepare设备令牌注册(删除空格和<>)
    的NSString * deviceToken = [[[[DEVTOKEN描述]
                               stringByReplacingOccurrencesOfString:@<withString:@]
                              stringByReplacingOccurrencesOfString:@>中withString:@]
                             stringByReplacingOccurrencesOfString:@withString:@];
    的NSLog(@%@,deviceToken);#万一
}

,然后当我跑我的服务器:

 周六,2013 5月11日13点37分53秒-0700 ApnsPHP [18198]:信息:试图
SSL://gateway.push.apple.com:2195 ...
星期六,2013年5月11日十三时37分54秒-0700 ApnsPHP [18198]:INFO:连接到SSL://gateway.push.apple.com:2195。
星期六,2013年5月11日十三时37分54秒-0700 ApnsPHP [18198]:信息:发送消息队列,运行#1:1消息(S)留在队列中。
星期六,2013年5月11日十三时37分54秒-0700 ApnsPHP [18198]:状态:发送消息ID 1 [自定义标识:ABC123](1/3):101字节。
星期六,2013年5月11日十三时37分54秒-0700 ApnsPHP [18198]:错误:无法发送消息ID 1:无效令牌(8)。
星期六,2013年5月11日十三时37分54秒-0700 ApnsPHP [18198]:信息:断开连接。
星期六,2013年5月11日十三时37分54秒-0700 ApnsPHP [18198]:信息:试图SSL://gateway.push.apple.com:2195 ...
星期六,2013年5月11日十三时37分54秒-0700 ApnsPHP [18198]:INFO:连接到SSL://gateway.push.apple.com:2195。
星期六,2013年5月11日十三时37分54秒-0700 ApnsPHP [18198]:信息:发送消息队列,运行2:1消息(S)留在队列中。
星期六,2013年5月11日十三时37分54秒-0700 ApnsPHP [18198]:警告:消息ID 1 [自定义标识:ABC123]有一个不可恢复的错误(8),从队列中删除,而不重试...
星期六,2013年5月11日13点37分55秒-0700 ApnsPHP [18198]:信息:断开连接。


解决方案

最有可能的解释是,你发送推送通知了沙箱设备令牌生产APNS服务器。

无论您使用的是由您的应用程序,而你在沙箱环境中测试,或者您的应用程序仍然是一个开发配置文件签署发送到您的服务器的旧设备的令牌,并仍在接收沙箱设备令牌该APNS服务。

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

我建议你检查配置资料,看看什么样的价值出现了APS权利。我也建议你从任何旧设备令牌清除分贝。

I am using this apns php server: https://code.google.com/p/apns-php/. I've have done all the production certs good. 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
}

and then 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.

解决方案

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

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.

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

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天全站免登陆