maxkomarychev / react-native-ultimate-config

Config that works
MIT License
262 stars 31 forks source link

xcode error profile doesn't match the entitlements file's value for the application-identifier entitlement. #13

Closed bill-dai closed 4 years ago

bill-dai commented 4 years ago

I must say RNUC is the easiest and neatest env config for React Native as right now. Thank you @maxkomarychev for this great package!

Everything works like a charm for me after closely following the instructions except XCode wouldn't treat my qa and prod env configs as different apps even though they have different bundle identifiers and display name. Whenever I switch the env, Xcode always tries to upgrade the previous install on the device and then with the failed installation error message: profile doesn't match the entitlements file's value for the application-identifier entitlement.

maxkomarychev commented 4 years ago

hey, thanks for kind feedback :)

regarding you problem: could you please share more information?

what exactly is your setup? do you use CLI to switch environments or did bind env to schemes? what does "tries to upgrade the previous install" exactly? does that mean it overwrites app in previous environment? do you keep xcode open when executing command (in case if switching with command line)?

bill-dai commented 4 years ago

Hi @maxkomarychev, I used CLI to switch environment before I build the app in Xcode. After running the npm run runc .env.qa, I do see bundle IDs and display names are being changed correctly in the general tab.

Yes, Xcode is trying to overwrite the app in the previous environment. It would not install a new app. Eg. If I switch from prod to qa, it will try to overwrite the prod app but with the error I mentioned. And the same if I switch from prod to qa.

Yes, I kept Xcode open when switching. Let me try running the config with xcode closed.

bill-dai commented 4 years ago

Just tried running the config with xcode closed. Still getting the same error in Xcode.

"This application’s application-identifier entitlement does not match that of the installed application. These values must match for an upgrade to be allowed."

maxkomarychev commented 4 years ago
  1. do you have both apps installed when running build in xcode?
  2. what kind of entitlements do you have? (push? keychain? etc) if you do have entitlements file you might need to have different file per environment, this is possible to configure with this lib
  3. can you try running app via react-native CLI?

any chance you can share screenshot of your entitlements file with masked data?

btw, maybe this helps https://developer.apple.com/library/archive/qa/qa1710/_index.html ?

xcode does not play well if xconfig is regenerated on the fly so its best to reopen it when switching environments

bill-dai commented 4 years ago
  1. Nope. Only one app can be installed at a time. Cannot install both from Xcode. The goal is to install both apps on the same device.
  2. I have push notification entitlement and background modes/remote notifications entitlement. I do see something weird about my entitlement file: myapp.entitlements. It has none of the push notification capabilities I added under signing and capabilities tab. Does this look correct to you? If it is, how do I make a different file per environment. Btw, I'm using the latest XCode 11.5 and React-Nave 0.60.6
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>aps-environment</key>
    <string>development</string>
</dict>
</plist>
  1. Running the CLI I didn't receive the error, but the app is upgraded from prod to qa instead of installing a separate app.
maxkomarychev commented 4 years ago

Does this look correct to you?

    <key>aps-environment</key>
    <string>development</string>

this is related to push notifications, looks good to me

Running the CLI I didn't receive the error, but the app is upgraded from prod to qa instead of installing a separate app.

are you running app with CLI on the device or simulator?

have you enabled push capabilities for both qa and prod apps?

All in all if the application name and bundle identifiers look updated in ui in General tab then library works, I suspect there might be an issue elsewhere.

Are both your apps registered under the same developer's account?

At this point I can only ask for more information (like share pieces of infoplist, more screenshots etc) or reproducible demo project.

bill-dai commented 4 years ago

The issue is now gone. I revoked the QA identifier, and created a new identifier and provisioning profile in my Apple dev account. And now XCode builds QA and Prod as separate apps now. I suspect it has to do with the automatic signing. The old QA identifier had exactly the same setup, but it didn't recognize it as a different identifier.

Indeed there's nothing wrong with RNUC, but Xcode settings and configuration issues.

Thanks for your help and patience @maxkomarychev !