0

I'm getting this alert message while getting device token by using this code.

"Error Domain=NSCocoaErrorDomainCode=3000"no valid aps-environment'entitlement string found for application" Userinfo=0x1665f5b0 {NSlocalizedDescription=no valid 'app-environment'entitlement string found for application}

- (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];

 }
Nathan A
  • 11,059
  • 4
  • 47
  • 63
  • 1
    Did you enable push notification for you app in the provisioning profile? – rckoenes Jun 13 '14 at 13:55
  • possible duplicate of [How to fix "no valid 'aps-environment' entitlement string found for application" in Xcode 4.3?](http://stackoverflow.com/questions/10987102/how-to-fix-no-valid-aps-environment-entitlement-string-found-for-application) – memmons Jun 13 '14 at 14:24

1 Answers1

1

The reasons for getting this issue is ,

  1. You didn't enable the push notification in your provisional profile .
  2. If enabled ,you may forget of using that bundle identifier and mobile provision .
sunil
  • 300
  • 3
  • 20
  • 1
    This solution is correct. Actually for checking device token with AMazon SNS sample app, i had to finally change the sample app's bundle identifier and run it using the push enabled provisioning profile. – tech savvy Sep 15 '14 at 09:53