How to fix “no valid 'aps-environment' entitlement string found for application” in Xcode 4.3?

前端 未结 23 1875
长情又很酷
长情又很酷 2020-11-27 10:43

I\'ve been trying very very hard to create a simple simple iOS app which can recieve push notifications. My only reason for doing this is to establish a procedure for some

相关标签:
23条回答
  • 2020-11-27 10:48

    First of all, you don't need the entitlements file unless you are adding custom key/value pairs that do not exist in the provisioning profile. When your app is built, any entitlements from the provisioning profile will be copied to the app.

    Given that you still see an error message about missing entitlements, I can only assume the code signing options are not correct in the build settings.

    You need to make sure the correct profile is selected for the "Debug" configuration, and to be safe, that you have selected the correct profile for both the "Debug" and child-node labelled "Any iOS SDK":

    enter image description here

    Although this screenshot shows the "Automatic Developer" profile selected, choose the exact provisioning profile you want from the drop down, just for testing purposes. It could be that Xcode is automatically choosing a different profile than the one you want.

    Also be sure to do a clean build, completely delete the app from your device, etc. This is just to make sure you don't have some old fluff hanging around.

    0 讨论(0)
  • 2020-11-27 10:49

    Delete old provisioning profile from XCode in Organizer.

    Then, generate a new provisioning profile for the same bundle id in iOS provisioning portal (after you have enabled push).

    Import the new provisioning profile in XCode, set it in your app build settings.

    Build, run, it works.

    I just did it.

    It took me 10 minutes from error to success.

    0 讨论(0)
  • 2020-11-27 10:50

    recreating provisional files fixed my all problems.

    0 讨论(0)
  • 2020-11-27 10:51

    I had a similar issue. I've been bouncing between XCode 7 and 8 for a variety of reasons. Once you use 8 to build, you will need to use 8. I simply used Xcode 8 and applied some of the changes suggested above and it worked.

    0 讨论(0)
  • 2020-11-27 10:53

    A lot of the above answers are correct. However, there seems to be more than one possible error when dealing with this.

    The one I had was a capitalization issue with my App ID. My App ID for some reason wasn't capitalized but my app was. Once I recreated the App ID with correct capitalization, it all worked smoothly. Hope this helps. Frustrating as hell though.

    P.S. if it still doesn't work, try editing the Code Signing Identity Field manually with "edit". Change the second line with the name of the correct provisioning profile name.

    0 讨论(0)
  • 2020-11-27 10:54

    Ok, I faced the problem before. Since push notification requires serverside implementation, for me recreating profile was not an option. So I found this solution WITHOUT creating new provisioning profile.

    Xcode is not properly selecting the correct provisioning profile although we are selecting it correctly.

    First go to organizer. On the Devices tab, Provisioning profile from Library list, select the intended profile we are trying to use. Right click on it and then "Reveal Profile in Finder".

    enter image description here

    The correct profile will be selected in the opened Finder window. Note the name.

    enter image description here

    Now go to Xcode > Log Navigator. Select filter for "All" and "All Messages". Now in the last phase(Build Target) look for the step called "ProcessProductPackaging" expand it. Note the provisioning profile name. They should NOT match if you are having the error. enter image description here

    Now in the Opened Finder window delete the rogue provisioning profile which Xcode is using. Now build again. The error should be resolved. If not repeat the process to find another rogue profile to remove it.

    Hope this helps.

    0 讨论(0)
提交回复
热议问题