2014-06-13 67 views
0

我在使用此代码获取设备令牌时收到此警报消息。设备令牌没有收到

“错误域= NSCocoaErrorDomainCode = 3000” 找到的应用”无有效 APS-environment'entitlement串 USERINFO = 0x1665f5b0 {NSlocalizedDescription =找到应用没有有效 “APP-environment'entitlement串}

- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)var_deviceToken 
{ 

    NSString *tokenString = [[deviceToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]]; 
    NSLog(@"Push Notification tokenstring is %@",tokenString); 
    self.deviceToken = tokenString; 


} 

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error 
{ 

    NSString* s=[[NSString alloc] initWithFormat:@"%@",error]; 
    UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Device Token didn't recieve" message:s delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
    [alert show]; 

} 
+1

您是否在供应配置文件中为您启用了推送通知? – rckoenes

+0

在Xcode 4.3中可能重复的[如何修复]无效的应用程序'aps-environment'权限字符串?](http://stackoverflow.com/questions/10987102/how-to-fix-no-valid- aps-environment-entitlement-string-found-for-application) – memmons

回答

1

获得此问题的原因之一是,

  1. 你没在您的临时个人资料中启用推送通知。
  2. 如果启用,您可能会忘记使用该捆绑标识符和移动设备。
+1

该解决方案是正确的。实际上,对于使用AMazon SNS示例应用程序检查设备令牌,我不得不最终更改示例应用程序的包标识符,并使用启用了启用预配置的配置文件运行它。 –