1

I am trying to implement push notification in app.

I have done that for ios 8. on iPad OS is ios8. I got push notification on iPad.

on iPhone OS is iOS7. whenever I compile app on iPhone I got error

/* Failed to get token, error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x16d246c0 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}*/

My app delegate methods are

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
 [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
 [[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
 // Let the device know we want to receive push notifications
 [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
 (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
return YES;
}
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
 {
NSLog(@"My token is: %@", deviceToken);
}
 - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
 {
 NSLog(@"Failed to get token, error: %@", error);
 }

Appreciate for help

asked Apr 16, 2015 at 11:01

2 Answers 2

1

The message indicates you are using a different signing certificate for iPad/iOS 7 than for iPhone/iOS 8, one without the permission for push notifications set. It has nothing to do with your code.

answered Apr 16, 2015 at 11:08
Sign up to request clarification or add additional context in comments.

Comments

1

Sounds like your app is picking up the wrong provisioning profile for whatever reason. Does it start working if you explicitly specify the provisioning profile?

answered Apr 16, 2015 at 11:10

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.