Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/250.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php APNS:无效令牌(8)_Php_Objective C_Push Notification_Apple Push Notifications_Apns Php - Fatal编程技术网

Php APNS:无效令牌(8)

Php APNS:无效令牌(8),php,objective-c,push-notification,apple-push-notifications,apns-php,Php,Objective C,Push Notification,Apple Push Notifications,Apns Php,我使用的是在提供的apns php服务器 我已经设置了推送通知证书,但我的代码仍然在连接时抛出错误 这有什么问题?以下是我获取设备令牌的方式: - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken { #if !TARGET_IPHONE_SIMULATOR // Prepare the Device To

我使用的是在提供的apns php服务器

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

这有什么问题?以下是我获取设备令牌的方式:

- (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
}

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

您正在使用应用程序在沙盒环境中测试时发送到服务器的旧设备令牌,或者您的应用程序仍然使用开发配置文件签名,并且仍然从APNS服务接收沙盒设备令牌

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


我建议您检查配置文件,查看aps权限的值。我还建议您清除任何旧设备令牌中的db

您是否在此版本中使用了临时资源调配配置文件?否则生产证书就不行了。@edwardmp是的,我想这就是问题所在。嗯。。。现在它不会抛出一个错误,即我更改了沙箱,但我的设备仍然没有收到通知。@JasonSilberman您到底更改了什么沙箱?应用程序还是服务器?如果您在服务器上使用了错误的证书(使用沙盒push certificate连接到生产APNS服务器,反之亦然),设备将不会接收任何内容,并且服务器将不会得到任何错误响应。我正在使用沙盒网关和沙盒证书。该
aps
权限应显示在您签署应用程序的配置文件中。您应该在您的个人资料中查找
,看看它的值是
开发
还是
生产
@Eran。您能检查一下我的问题,看看是否还缺少什么吗。一切似乎都是正确的,但我还是犯了同样的错误
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.