I am trying to configure my app to support push notification, but keep getting this error:
Failed to get token, error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x1f818fc0 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}
I did enable my app to support push notifications (only for development at this point).
I did create the provisioning profile AFTER enabling the push notifications.
My bundle identifier is the same as appears in the profile.
In my profile file there is a string: aps-environment
I made sure that in both project and target under the "Code signing identity" section ALL the values are selected to be my provisioning profile.
Any more ideas? Thanks.
In my case, the stuff in my provisioning profile:
security cms -D -i ~/Downloads/spolskyDevelop.mobileprovision
...
<key>application-identifier</key>
<string>P5GM95Q9VV.com.dca.spolsky</string>
<key>aps-environment</key>
<string>development</string>
Was different than the stuff in the app that was actually built (you can find out where it is built by looking at Xcode's Logs tab)
codesign -d --entitlements - '/Users/drew/Library/Developer/Xcode/DerivedData/spolsky-bdbtdfjeeywhqzccpmmceqvnhgtm/Build/Products/Debug-iphoneos/spolsky-ios.app'
<dict>
<key>application-identifier</key>
<string>Y2X6Z7Z2GR.com.dca.spolsky-ios</string>
<key>get-task-allow</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>Y2X6Z7Z2GR.com.dca.spolsky-ios</string>
</array>
</dict>
This was true even though the "Currently Matches" hint text under Code Signing Identity was indicating the correct provisioning profile--weird, huh? To make a weird story weirder, the correct provisioning profile was being installed on the device when I ran, (Settings->General->Profiles) leading me to believe the provisioning profile was right--but it was falling back to a wildcard ID when the app was actually launched.
The clue was the difference in the output of these two commands:
Y2X6Z7Z2GR.com.dca.spolsky-ios vs P5GM95Q9VV.com.dca.spolsky
When I made the bolded part match, the italicized part changed to match automatically. In addition, the output of security and codesign were in agreement, and no more aps-entitlement error.
My guess here is that XCode was using a wildcard-style match on my non-wildcard ID. ("spolsky" is, after all, quite nearly "spolsky-ios"), and this explains the "Currently Matches" output. But something in the build chain is more strict about this, so it falls back to an actual wildcard ID during the build.
The problem is 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 will clear the error.
I had this same problem after push notifications were already working on my device. Seemed like Xcode cached something incorrectly so refreshing it fixed my problem:
Xcode -> Preferences -> Accounts
View Details for your Developer Account
Just click Refresh for the Provision Profiles a few times. I was seeing these change with each refresh. Keep refreshing until they stop changing.
i got this error and did not create a new provisioning profile; created a new one and then had to restart xCode but works now!
Be aware that the bundle identifier must match the provisioning profile in a case-sensitive manner. I had something like com.FirstLast.appname when it should have been com.firstlast.appname. Well, that kept me busy for quite a while.
I fixed this problem by enabling push notification capability.
Select Project > Target > Capabilities > Turn On Push notifications
If this problem happened suddenly after upgrading to Xcode 8 you might find a warning in the capabilities screen that'll allow you to fix this automatically:
Select Project > Target > Capabilities > Turn On Push notifications
Product->Clean did it for me. Hopefully it does it for someone else.
I ran into this in what's possibly a non-frequent use case. I'm working with Xcode 6 and iOS 8. I was creating a series of entirely new app projects, and attempting to re-use the same bundle ID, so as not to need to go through all of the portal-side setup again. This too was just for sandbox testing.
I would find that, while the setup and registration would work fine for the first app, if I deleted that app from the device, set the same bundle ID for the second app, and then attempted to register PNs with that app, I would get this error.
My solution was to:
Remove the associated provisioning profile from the device.
Remove the associated provisioning profile from Xcode.
Close Xcode
Double-click my downloaded .mobileprovision file to install it back into Xcode
Open the project and deploy it.
This approach seems to jar loose whatever previous state was there, and I'm able to register for PNs with the new app / same bundle ID.
For those who got this error in ios 10, you can try following steps:
1.clean your project.
2.and check Targets -> Capabilities -> Push Notification.If it is off,On it.
And problem will solve.The above steps help me to get rid off this problem. Hope it will helpful to someone.
New provisioning profile worked for me. Make sure to use a Developer profile if you are in development (don't use Ad Hoc). It was fine after that, no idea why the old one stopped working right.
Related
I am unable to add a new iOS app to fabric by following the instructions of the Fabric macOS plug in.
I have followed all of the instructions found at Crashlytics documentation
When running the app, I receive this error:
2018-03-12 14:22:24.090838-0400 [19139:8550117] [Crashlytics] Version 3.10.1 (129)
2018-03-12 14:22:24.636050-0400 [19139:8550293] [Fabric] unable to complete application configure: Error Domain=FABNetworkError Code=-5 "(null)" UserInfo={status_code=422, type=2, request_id=fbc432572e6f0e10f21d2ddc24c7f272, content_type=text/html; charset=utf-8}
I have tried searching StackOverflow and following answers, but no luck avoiding this error message.
Any ideas on this error message?
I had this problem and discovered that my 'visible' (in Xcode) info.plist was not a file in my root directory, and was an out of date version from earlier development activity. I am not sure why my correct/current info.plist did not display in Xcode. I found the current info.plist in Finder (it was in the root directory in Finder, just not appearing in Xcode). I dragged the file from Finder to Xcode and accepted all the defaults in the dialog that appeared. Then I simply built and ran the current scheme and all worked as it should.
Note: It appears that for some time I have been updating the 'invisible' info.plist directly from my apps Target / Info tab.
Make sure to include all dependency then throw a force crash or runtime error and do not forget to turn on your data or internet connection.
I had checked my provision profile and certificate. It was no problem to upload app in Xcode 7, but after update to Xcode 9, I receive error in Xcode
Apps must contain a provisioning profile in a file named embedded.mobileprovision
From application uploader I have error, too. Spent a lot of time to fix this problem, but has no idea for this time.
The IPA structure for any IPA is as follows. Make sure to rename the IPA to .zip and extract, then you will have to Ctrl+Click and say show package contents to see the inside App.
Structure :
Payload
MyApp.app
-- _CodeSignature
-- Plugins (optional if you have extension like Siri, widget)
-- Watch (optional if you have extensions for watch)
-- archived-content....xccent
**-- embedded-provisionign.profile**
-- Info.plist
Now check this profile if its double clicked and installed properly in your Xcode and found, if not the profile cert and p12, and profile file have issued from the generation time. Solve this and try to compile new IPA.
It should solve your purpose. Note If you are using a developer account, go to its dev portal member centre and see if the profile and AppId are valid as per one in the code. You can check the extracted above Plist for the CFBundleIdentifier value and check if its relevant dev account portal profile is Active and not Invalid due to any cause for that APP ID associated with the profile.
I have the latest Xcode 7 and iOS 9 SDK installed on my El Caption. I just get an issue about the Code Signing Resource Rules Path:
If I specify the CODE_SIGN_RESOURCE_RULES_PATH=$(SDKROOT)/ResourceRules.plist then I can not upload the IPA to iTunesConnect because:
ERROR ITMS-90339: "This bundle is invalid. The Info.plist contains an invalid key 'CFBundleResourceSpecification' in bundle
However, if I removed this CODE_SIGN_RESOURCE_RULES_PATH the xcrun PackageApplication will fail as:
/var/folders/9v/_4lr188x5h5019b4bsq2_fyr0000gn/T/ir4fp619hu/Payload/MyApp.app/ResourceRules.plist: cannot read resources
Any walk around?
The issue is that xcrun uses the resource path internally in its script.
The work around to is go and directly edit the script ourselves. I had the same issue and the solution i posted here worked for me. Thought it'd help you as well.
This used to work for me, but now whenever I attempt to "Run in Simulator" with any of the iPhone or iPad types selected, I instantly get the console message
2013/10/1 10:4:48 Error: Script error. (URL: , LineNumber: 0)
I am working in the latest version of Chrome. Any help would be appreciated!
Just so that other users are aware, you can get that error on almost any problem in Mist and identifying the cause usually requires that we (I'm part of Icenium team) look into the specific project. In this particular case the problem was caused by missing App_Resources folder, which blaster has removed from his repository prior cloning it in Icenium. Generally an Icenium project should be able to function without this folder and we would fix this for the next version.
I am sorry for posting so many questions, but getting this to work has been incredibly painful, even tho Testflight makes it much easier
Invalid IPA error: The APS environment in your embedded.mobileprovision and your binary don't match
I figure this has got to do with my Apple Push Notifications. I am using my distribution profile across all my settings. My app has been configured to both development and production.
What could the causes of this error be?
As a side note, I have been working on this for the entire day, and I get stuck at one thing after the other, esp involving static libraries and xcode4. Am I really bad at this, or does Apple really make it so hard?
I think it was an xcode bug. Here's how i solved it, and maybe it can be useful for some users in the future. Including my problem solving steps for reference:
i changed the entitlement file to aps-environment = production. No go, still different between the 2 files.
i changed ALL my settings (debug/not) to the distribution profile, just to be sure
I built it again, and checked out the embedded.mob and binary as you suggested
No go again.
I went nuclear - deleted all my profiles, downloaded only the distribution build i needed
here is when it became interesting - i could not build it on debug (expected), but i was having the same problem of "profile not found" even when i was in ad hoc archiving mode. Surely that means that there remains a reference to the developer mode even when i was trying to archive it (given that i have already changed ALL my settings and deleted all my other profiles)
So i digged up project.pbxproj, and found the offending line that was still trying to access my development profile in ad hoc build. I changed it manually, and bingo, things worked as per expected
End of the day, i am surprised why this would happen. It seems like an xcode 4 bug. Normally it is my fault when these things happen, but this seems arcane enough (plus i had so much trouble with xcode 4 for a few other things).
Solved with help from the amazing Testflight team!
http://support.testflightapp.com/discussions/tools/17-invalid-ipa-the-aps-environment-in-your-embeddedmobileprovision-and-your-binary-dont-match
Also, particularly if the target you're archiving was based on another target, double check that your target's "Archive" Scheme is based on the correct Build Configuration of Build Settings.
In Xcode 4.2 next to the run menu, click on -> Edit
Scheme
Click on the 'Archive' button in the left drawer
Look at 'Build Configuration
For Testflight, I replicate my Release Build Configuration, and rename it 'Ad Hoc' for just this purpose, specifying my Ad Hoc provisioning profile and whatever else needs to be in there. If you've gotten this far, I presume you've already done that, but for posterity, I figured I'd mention it.
I ran across this error before as well, so follow these instructions for this to work:
Create a provisioning profile for your app and add the devices to it of the people who should test it.
Build your application using that provisioning profile you just created and export it as an *ipa.
Upload it to TestFlight and select the devices that you want to test the app on.
Many people miss step 2, (so did I) and that's essential for it to work. So give it a try! :)
Replying this question, in case someone bumps onto this while uploading an air mobile app.
Make SURE you check the Entitlements element in your app.xml.
<iPhone>
<InfoAdditions>
<![CDATA[
<key>UIDeviceFamily</key>
<array>
<!-- iPhone and iPod touch devices -->
<string>1</string>
<!-- iPad devices -->
<string>2</string>
</array>
]]>
</InfoAdditions>
<!-- This part below.. -->
<Entitlements>
<![CDATA[
]]>
</Entitlements>
My Entitlements looked like this back when I got the error:
<Entitlements>
<![CDATA[
<key>application-identifier</key>
<string>QFY9MVY9K8.com.somethingHere.anAppName</string>
<key>aps-environment</key>
<string>development</string>
]]>
</Entitlements>
This is how it looks now:
<Entitlements>
<![CDATA[
<key>get-task-allow</key>
<false/>
]]>
</Entitlements>
This error was caused because
I used a DIFFERENT ID in the <key>application-identifier</key> than the one in my provisioning profile.
I used development key instead of production in the <key>aps-environment</key> part.