So I have this app called Dripper that I put out about a month ago and then an update a couple days ago. The update added push notifications and a few little tweaks. I tested it with the sandbox-apn using the development profile and things worked great. Then I switched things to the production-apn and pushed it to test-flight, again things worked perfectly. Once I put update on the market and ran it I noticed I wasn't getting any new push registrations on the server. I looked at the console logs for the device and found this:
Dec 4 17:55:15 Ina-touch-it coffco[1210] : Registering for remote notifications
Dec 4 17:55:15 Ina-touch-it SpringBoard[52] : No valid 'aps-environment' entitlement string found for application 'Dripper': (null). Notifications will not be delivered.
Dec 4 17:55:15 Ina-touch-it coffco[1210]<Warning>: Failed to register with error : Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x174270900 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}
I am a bit confused because I thought that the production-apn would function the same between ad-hoc and app store builds.
Here is my app id and its entitlements:
Here is the provisioning profile for the apps store:
I fixed this issue like this:
And try again!
Source:
Such problems are due to current Provisioning Profile does not contain APNS information, as the Provisioning Profile is created BEFORE creating the APNS certificate.
Therefore, to solve the problem, create a new Provisioning Profile & select the Provisioning Profile in Xcode. Then you are DONE.
Also, when you add push, I believe you have updated the certificates in keychain too.
Regarding Xcode 9, some of the answers are outdated or incomplete to solve this specific issue.
Here was the steps to follow for me:
( FCM is not a prerequisite for push notification but their guides are amazingly clear, here is the link )
To test your app while under development, you need a Provisioning Profile for development to authorize your devices to run an app that is not yet published on the App Store.
I had the same problem using iOS 8.0 and above versions; I didn't get the device token and was giving error: "no valid 'aps-environment' entitlement string found for application"
I fixed it by using below steps
and now run the project definitely it'll work.
For some reason Wei's solution was not working for me. When clicking the Fix entitlements, Xcode generated two files and it still did not function, indeed the generated entitlements files were empty.
This was caused (apparently) by the PRODUCT_NAME of the project being rather long and including spaces and "ä" and "ö" letters. After changing it to a short version with english-only letters the fix by Wei worked correctly.
It took me a while to figure out what causing no valid aps-environment entitlement error. The problem was that there were two .entitlements files in XCode project. One is platform/ios//.entitlements and another one is platform/ios//Resources/.entitlements and the appropriate entitlements is present in the former file only while XCode is configured to use the latter. I updated the latter file manually and everything started to work. Another option to fix this is to change which .entitlements is used by XCode. This can be done in Build Settings --> Signing --> Code Signing Entitlements config param.
I'm not sure why there are two .entitlements files in XCode. Could it be that the cordova push plugin created the second one (i'm developing a hybrid cordova mobile app)? And what is the correct location for the .entitlements file?
I experienced this issue and resolved it with the first solution.
However, I have failed once because I had two apple accounts logged-in. After removed one, everything became working.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.