Before writing a Demo about APNs, it is ready to run.
Now, you want to add APNs features to your existing app.
Need 1-3:
1. Re-apply for certificate enabling push notifications
2. Re-build the description document provisioning profile
3. Modify app unique ID consistent with Appids settings
Problem: Unable to register Remote notifications
Did Fail to Register for Remote notifications with Error:error domain=nscocoaerrordomain code=3000 "no valid" Aps-environ ment ' entitlement string found for application '
Workaround:
If 1-3 steps are confirmed, the problem of no valid ' aps-environment is still not resolved, then it is possible that Xcode failed to update the certificate (Xcode bug).
1. Close your project, locate the project file Xxxx.xcodeproj, right-click on the file, and select "Show Package Content" (shows Package Contents). A new finder will be opened. Note: In fact, Xxxx.xcodeproj is a folder, where the newly opened finder inside the three files is the file inside the Xxxx.xcodeproj folder.
2. Locate the project.pbxproj in the newly opened finder and open it. Find the coded information for your previous certificate. The error message I had previously reported was
Code Sign error:provisioning profile ' 37d44e7f-0339-4277-9a82-c146a944cd46 ', so I found all the rows including 37d44e7f-0339-4277-9a82-c146a944cd46 in the way I looked, and deleted them.
3. Save, restart your project, and then compile. It's OK.