Frustrating Bundle ID and code signing issue after adding WatchKit to existing app

So I'm an experienced iOS Dev, I've been building apps since 2009 and have never come across an issue as frustrating as this in all that time. I've raised this as a TSI request with Apple only for it to be bounced back to iTunes Connect who threw some documentation at me and then went dark.


Here is my issue:


My very first app created in 2009 has the app ID 467SNW7GHZ. At the time I was in way over my head and it was all I could get to work and although I've now learned to use com.company.appname etc this app unfortunately is stuck that way.


Although this app is at version 2.3 and has had many updates over the years it hasn't been updated since 2013 and I've decided to make it 64-bit and contain a WatchApp and WatchExtension. I am not using App Groups and have no need for the entitlement.

At present my bundle ID structure is like this:

  • App: 467SNW7GHZ.
  • WatchApp: 467SNW7GHZ.watchkitapp
  • Extension: 467SNW7GHZ.watchkitapp.watchkitextension
  • Companion app ID: 467SNW7GHZ.
  • WKAppBundle ID: 467SNW7GHZ.watchkitapp


This issue I'm having is code signing. I am getting a validation error in organiser stating the following (app names have been removed for security purposes):

Invalid CFBundleIdentifier value 467SNW7GHZ.watchkitapp of watch application 'App.app/Watch/Watch App.app' does not properly extend the CFBundleIdentifier value '467SNW7GHZ.' of it's containing iOS application.


As for provisioning. I have 3 app ID's setup, one existing one for the main app, a second for the WatchApp and the third for the Extension and then 3 distribution profiles using the same bundle ID's as given above. I have Automatic CodeSigning/Provisioning disabled in Xcode and I am manually choosing the provisioning profile. Doing this gets me down to the one error, enabling automatic signing causes the errors to go haywire. I am explicitly selecting iOS Distrubtion: (Team Name) as the code signing identity and all of my certificates are valid (I submitted an app to the store only last week with no issues).


Looking at my earlier builds, I have always used 467SNW7GHZ. as the bundle ID and nothing else to code sign this app with no issues.

I have followed every guide and internet post I can find and have come to a complete dead end. It's very hard to find advice when the format of my initial bundle ID is different to the standard reverse domain name that is now more commonly used.


I understand how the Bundle ID's must be setup and as far as I can see my current setup is ordered correctly (e.g. WKAppBundle ID referencing the Bundle ID of the WatchKitApp etc) however something isn't working.


I have also checked that the Bundle ID's are all matching in the info.plist, Identity inspector and build settings as well, prior to archiving, as I realise that Xcode sometimes does not carry one entry over to the other first time.


In addition. If I remove the WatchKit and Extension targets from the build, the app validates perfectly using the Bundle ID 467SNW7GHZ.

Any ideas? I've been wrestling with this issue for 6 days now.

I found this in an archived thread: via the MLT links below - not sure if it applies in your example, tho:


>"...there seems to be really a requirement that the bundle identifier of the app must be a prefix of the one of the extension. But there is no WKAppBundleIdentifier needed for building the project."


Reason why I point this out is that the bundle IDs are just strings (they just need to be unique from other apps), but it appears there is a situation that isn't clear when it comes to wk/extensions.

I figured it out. It was so obvious in hindsight and I feel pretty stupid now.


My Bundle ID was 467SNW7GHZ. and the period at the end actually counted as the BundleID itself.


So 467SNW7GHZ.watchkitapp needed to become 467SNW7GHZ..watchkitapp with a double period.

That would do it - thanks for the followup and good luck w/your apps.


Ken

Frustrating Bundle ID and code signing issue after adding WatchKit to existing app
 
 
Q