"Automatically manage signing" doesn't use the right AppID prefix

Hello everyone,


I created and published an iOS application some years ago (2010) on the App Store.


I didn't update it since, but I want to update it to be ARM64, so it runs on iOS 11.


The project by itself was much too old (I don't remember with which version of Xcode I created it - probably Xcode 4) and upgrade to Xcode 8 doesn't work that much. So I decided to create a fresh new project with the exact same name and exact same product identifier (say it's "com.mycompany.myapp"), and re-added all sources of the old project.


The project is configured to use "Automatically manage signing", and work very well inside the simulator, and on my iPhone 6. So far, so good.


But now, I try to release this update on the App Store, and when validating my stuff, it fails by saying :

- On Xcode 8.3.3 : "no matching provisioning profiles found for '***'".

- On Xcode 9.0 GM : "Provisioning profile failed qualification — Profile doesn't match the entitlements file's value for the application-identifier entitlement".


I tried with and without having Provisiong Profiles for Distribution on https://developer.apple.com/account/ios page. I get the same result whatever I do.


After some investigations, I found that Xcode generate this entitlement file, and pass it with "--entitlements" to CodeSign steps :

"/Users/<User>/Library/Developer/Xcode/DerivedData/<MyApp-xxxx>/Build/Intermediates/<MyApp>.build/Release-iphoneos/<MyApp>.build/<MyApp>.app.xcent"


This file contains an "application-identifier" key, which is "YYYYYYYYYY.com.mycompany.myapp" (with YYYYYYYYYY != than my TeamID, which is expected, I think).


The problem is my AppID (I'm not sure it’s still mandatory to create AppID in 2017, but in 2010 it was the case, and I can't remove it as my app -the old version- is currently published on the App Store) is "ZZZZZZZZZZ.com.mycompany.myapp" with YYYYYYYYYY != ZZZZZZZZZZ.


I have absolutely no idea where this "YYYYYYYYYY" come from, but it seems to be the problem : if I manage manually profiles in Xcode (by using the one I created on the developer website, associated with my AppID), then everything works fine (and the right prefix is used for the "application-identifier" of the entitlement file generated by Xcode).


So it seems Xcode is lost somewhere, but I don't have any idea where.


Have you any idea of what is happening ? Can it be fixed properly (I mean : I don't want to remove the app from the App Store for example) + stay in "Automatically manage signing" mode ?


Perhaps this deserve a TSI or a Bug Repport, I'm not sure.


Thank you 🙂