我正在使用
https://code.google.com/p/apns-php/提供的apns PHP服务器.
原文链接:https://www.f2er.com/php/139471.html我已经设置了推送通知证书,但是我的代码仍然在连接上引发错误.
这是什么问题?这是我如何获取设备令牌:
- (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 }
这是运行我的服务器时的错误:
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,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.