Been Stuck on this one issue for quite a while now. Trying to run the following line:
[application registerForRemoteNotifications];
and getting the 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) Recreating a provisioning profile 2) Recreating ID and checking that it matches and has push enabled 3) Clean and rebuild, etc 4) Creating of new certificates 5) Refresh with Xcode > Preferences > Accounts > View Details (Select your account)
Wondering if anyone has any solutions for this?
Happy to share any other information that people might find useful for solving this problem.
Thanks a lot in advance for help!
Go to your projects Target under Capabilities
section, you'll find this error glowing. XCode may suggest to fix it for you automatically.
You'll have to create a two entitlements(AppName_Debug.entitlements and AppName_Release.entitlements) file within your project with the following content: 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>
Add these two files under Code Signing Entitlments in Build Settings under appropriate option.
You don't have a valid provisioning profile or team is none
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With