51

I am using Xcode8, swift 3, iOS 10

In Targets -> capabilities showing "add the Push notification feature to your app id".

I check my APP ID and it is showing pushnotfication enabled in both development and distribution.

With same APP IS and certificate I am getting notification in iOS9 but in iOS 10 i am getting error

Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo={NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}  

and also showing red mark (issue)

Naresh
  • 16,698
  • 6
  • 112
  • 113
New iOS Dev
  • 1,937
  • 7
  • 33
  • 67
  • @Anbu suggested answer is not according to question asked, my question is for Xcode8 and swift 3 testing on iOS10 – New iOS Dev Nov 09 '16 at 12:37

11 Answers11

119

I restarted XCode and it was gone :-)

SteMa
  • 2,945
  • 2
  • 24
  • 30
14

Close Xcode -> reopen -> clean -> build -> run.

Fixed the issue for me. Xcode 9.0.

DBIT
  • 182
  • 2
  • 11
11

Sadly I quit xcode then installed the .mobileprovision (double clicking it) then restarted xcode and the warning was gone...Followed the other answer here by SteMa

ToolmakerSteve
  • 18,547
  • 14
  • 94
  • 196
sam k
  • 1,048
  • 2
  • 14
  • 22
8

This happened to me. For some reason xCode signed me out. The fix: Tap Xcode (top bar) -> select Preferences -> select your Apple Id -> Sign-in. Hope this helps someone!

Gary Mansted
  • 269
  • 3
  • 9
7

In my case it does not help restarting xcode again.

I just restart system and that problem was gone.

ton1
  • 7,238
  • 18
  • 71
  • 126
  • Yup, for those of who restarted XCode and still didnt get it fixed, restarting the pc works. – Shyam Aug 23 '18 at 05:22
5

After I enabled push for my app, I had to regenerate my provisioning profiles and re-download them for Xcode to recognized the aps attribute.

Sandy Chapman
  • 11,133
  • 3
  • 58
  • 67
  • Can you please provide an example for what you did? From where would I regenerate my provisioning profiles and from where to re-dowload them and where to put them after download? I'm very new to xCode. – Ionut Necula Aug 30 '17 at 10:58
  • 1
    @Ionut you have to regenerate the provisioning profile in the https://developer.apple.com/account/ios/profile/production of your account after you enable push for your app. You then re-download the profile and add it to Xcode in your app signing section. – Alappin Dec 23 '17 at 05:14
3

In my situation I went to here enter image description here & here enter image description here

under the general tab in xCode settings and reset my bundle identifier to a different name and it fixed the certificates and everything worked!

Obviously if you need the same bundle identifier you will need to go with some of the other suggestions here, but use this if all else fails.

Joseph Astrahan
  • 8,659
  • 12
  • 83
  • 154
2

In my case, none of the above answers worked. I had to generate new certificates. Xcode >> Preferences... >> Accounts >> select team >> Manage Certificates... >> + >> iOS Development >> repeat + >> iOS App Store.

Codeicus
  • 582
  • 5
  • 13
0

IF you have enabled Push notification ,your old Provisioning profile become inactive . Edit that old Provisioning profile and download fresh one , then try to generate the build .

Chandramani
  • 871
  • 1
  • 12
  • 11
0

Check Info.plist -> Bundle identifier and establish it as YourProject -> Targets -> General -> Bundle identifier. Work for me

Ivan
  • 1
  • 2
0

Change your developer account in Xcode, because of APNS certificates developer account and Xcode developer account must be same.

--> Go to Target

--> Go to General Tab

--> GO to Signing

--> Select Team, Which account you used to develop APNS certificates.

Naresh
  • 16,698
  • 6
  • 112
  • 113