2014-02-10 60 views
1

我有这个APNS laravel包安装没有问题,但我没有击中与我们的设备令牌砖墙。PHP的设备令牌格式APNS

https://github.com/ZhukV/AppleApnPush

我们令牌存储在MySQL和看起来就像这样(我改了几个字符)

'4739a92133dd5311d623e97cbe2d141e1b216c6e' 

,我们不断收到回

'Device token must be a 64 charsets, "40".' 

是否有一些特殊的我应该将我的设备令牌传递给这些方法吗?

+0

编辑您的令牌后,看起来像设备ID。这不一样。 – Thorsten

回答

3

你需要在你的AppDelegate调用此获得令牌:

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge |UIRemoteNotificationTypeSound)]; 

- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { 
// Prepare the Device Token for Registration (remove spaces and < >) 
NSString* devToken = [[[[deviceToken description] 
         stringByReplacingOccurrencesOfString:@"<"withString:@""] 
         stringByReplacingOccurrencesOfString:@">" withString:@""] 
         stringByReplacingOccurrencesOfString: @" " withString: @""]; 
NSLog(@"devToken=%@",devToken); 
} 

令牌是这样的:

bbb4231be5df46d6e9c1e4c3418ad56456c671eb7101818d8cc9ac80445727a8

ESP。您的令牌中尾随的“=”看起来可疑。