1
votes

I try to implement push notification in my iPhone application. I have create Provisioning Profile and App-id for push notification and add this certificates into Xcode. Connect iPhone device to mac system and build application through device for read Device token using the following code.

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    NSLog(@"didRegisterForRemoteNotificationsWithDeviceToken:\n%@", deviceToken);
}

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
    NSLog(@"didFailToRegisterForRemoteNotificationsWithError:%@", [error localizedDescription]);
}

But it returns error.. like

didFailToRegisterForRemoteNotificationsWithError:no valid 'aps-environment' entitlement string found for application 2012-07-18 14:18:08.597 Z2NotifyMe[1874:707] didFailToRegisterForRemoteNotificationsWithError:Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x11fee0 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}

I have remove all old certificates in Xcode and my device, then re-create all certificate newly then execute above same code it returns same above error.

Please help solve this problem.

Thanks..

3
Did u try to create a new provisioning profile from scratch? did u configure your appId to enable push notification in the Provisioning Portal? - Eyal
Yes, I enable push notification on my Provisioning Portal. - Prasannakumar.M

3 Answers

0
votes

Register your device using the following code :

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

In the applicationDidFinishLaunching: method.

I hope that the device on which you are trying is not Jailbroken.

0
votes

I had a similar problem when I did all the steps correctly but i still got this error.

Try doing the following steps, it helped me:
1) Go to you Provisioning Profile -> Provisioning
2) Press the "edit" button in the right hand side near your app provisioning profile - > then modify
3) Make some change here, it doesn't really matter what the change is, this is just to trigger a new profile. Unselect one of the devices, or change the name, you can change it back later.
4) press the "submit" button
5) download the profile and drag it to Xcode. (delete your old profile in Xcode before)