Failed to get token, error: Domain Error = NSCocoaErrorDomain Code = 3000 "no valid 'aps-environment' permission string found for application"

Stuck on this issue for quite some time. Trying to run the following line:

[application registerForRemoteNotifications];

and get an error

(via: - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
    NSLog(@"Failed to get token, error: %@", error);
})

2015-04-03 16:06:42.753 TownHall[696:169453] Failed to get token, error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x17426a1c0 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}

Tried some of the stuff with the following associated post http://stackoverflow.com/questions/10987102/how-to-fix-no-valid-aps-environment-entitlement-string-found-for-application but little luck. 

This includes: 1) Recreation of the preparation profile 2) Re-creation of the identifier and verification of its correspondence and pressing 3) Cleaning and restoration, etc. 4) Create new certificates 5) Renew using Xcode> Settings> Accounts> View details (select your account)

I wonder if anyone has any solutions for this?

We are pleased to report any other information that people may find useful to solve this problem.

Thanks for the help!

+4
2

. Capabilities , . XCode . enter image description here

(AppName_Debug.entitlements AppName_Release.entitlements) : AppName_Debug.entitlements

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
      <dict>
        <key>aps-environment</key>
          <string>development</string>
      </dict>
</plist>

AppName_Release.entitlements

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
      <dict>
        <key>aps-environment</key>
          <string>production</string>
      </dict>
</plist>

.

enter image description here

+10

+2

All Articles