Search code examples
iphoneobjective-cpush-notificationurbanairship.com

iPhone:don't receive push notification using urban airship


I am using push notification using urban airship in my application using the documentation

I write the code as follows

NSMutableDictionary *takeOffOptions = [[[NSMutableDictionary alloc] init] autorelease];
[takeOffOptions setValue:launchOptions forKey:UAirshipTakeOffOptionsLaunchOptionsKey];
 

[UAirship takeOff:takeOffOptions];

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

but I receive following error log in my console.

did Fail To Register For Remote Notifications With Error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0xce2a310

I twice checked documentation and implement the code

On the site of urban airship it shows msg that "no device token found" then what should be the problem.


Solution

  • Try the below steps :

    The problem is indeed the provisioning profile -- this is iOS reporting it, so there's no way around it. Here's my suggestion:

    1. Delete the app and provisioning profile on the device.
    2. Sync with iTunes, to make sure it's fully removed
    3. Delete the provisioning profile from Xcode.
    4. Restart Xcode
    5. Re-generate and re-download the provisioning profile from the iOS Provisioning Profile.
    6. Open the profile in a text editor to make sure it has the 'aps-environment' present
    7. Load the profile into Xcode, and set the Code Signing Identity to use the right profile.

    That should make sure Xcode loads the right profile and installs the app; I've seen it fail silently, so being thorough is your best bet.

    You can search more about this at where I found above solution : https://support.urbanairship.com/customer/portal/questions/13141-push-error-failure-to-register-on-iphone