Well I spent about 4 hours today grimacing at Xcode for one weird reason or another. I know a lot of you are submitting your latest apps with Apple Watch extensions, so lets go through what tripped me up (and what might trip you up)…
No more going to the Simulator
To Archive your app, which is the last step before Validating it and then Submitting it to Apple, you need to deselect any of the Simulator options in the upper left of Xcode. Otherwise if you go to Product > Archive it will probably be greyed out. If your device is plugged in, select your device. Otherwise, just select iOS Device.
If all goes well, you’ll see a new screen, with a button to Validate your app. If all goes well validating, you can Submit the app. Lucky you!
Onto some issues…
Don’t hesitate to Quit Xcode and/or do a Clean Build Often
As a general reminder, occasionally you just have to quit the program. And before you do, hold down the Option key, find your way to the Product menu, then hit Clean Build Folder (as opposed to just Clean, if the Option key isn’t held down). I had to resort to this a lot today, usually between Running the app, and trying to Archive it. Even when I wasn’t having the other issues laid out below, Xcode was just having trouble today. I saw a lot of this PBXCp Error….
Quitting helped solve this error every time.
Do we or don’t we add a Bundle ID and Provisioning Profile for the .watchkitextension and .watchkitapp??
Some folks seem to think so, but it looks like the Developer Center is doing this for you. Take a look below….
I swear I didn’t add those ID’s myself. So I would hold off on manually creating your own Bundle ID’s that include the .watchkitapp and .watchkitextension. At some point either Xcode or the Developer Center will do this for you. Maybe after one of the many times I hit “Fix Issue”. Or possibly it happened after I deleted my previously created profiles and made new ones. Hint. Try that.
Another odd thing is these profiles would randomly go Invalid. But I noticed that the last time I submitted an app, so its nothing new. File it under “General High Strangeness”. To make them switch back to Active (if that even matters), you just hit Edit, then do nothing, and they are fine again.
Apparently Xcode wants to use your Developer Provisioning Profile for Release?
Here’s the error message.
Embedded binary is not signed with the same certificate as the parent app. Verify the embedded binary target’s code sign settings match the parent app’s.
Embedded Binary Signing Certificate:iPhone Developer: Justin (123456789)
Parent App Signing Certificate:iPhone Developer: Justin (123456789)
At first I thought this error was due to having two development provisioning profiles under my account, so I deleted one. Which may or may not have helped the situation. But by this time, I was monkeying around in the Target’s Build Settings for both the iPhone app and Watchkit Extension. Most developers have had to tinker with their app’s Code Signing Identity, and I figured it was just one of those days to do that (for reference, see the screenshot below). Normally the Debug row automatically picks the iOS Developer profile and the Release rows choose iOS Distribution, which correspond to the Development Provisioning profile and Distribution profiles created for the app. Makes sense right?
Well at some point I noticed the Release rows were using iOS Developer, and I manually switched them to iOS Distribution. Which isn’t an uncommon problem, sometimes Xcode just gets confused. Apparently, Xcode knew what it was doing this time, because as much as I fought and fought and fought against this, when I finally gave in, I could Archive the app.
Easy mistake: Icons.
Yeah, yeah, yeah. A battle-hardened developer like yours truly shouldn’t be fumbling with icons, but whatever. It happens. This was actually a 4th quarter mistake just to make submitting my binary slightly more miserable than it already was the previous few hours. Turns out the WatchKit Extension needed an AppIcon set (it didn’t by default), so I had to add that. Then my icons each (mysteriously) had some Alpha channel data, but this error didn’t show up until after the binary passed Validation and Submission!
Yes I got my app Archived. It finally Validated, and it did get Submitted. Now to wait a week and see why’s its getting rejected. Probably my device icons aren’t similar enough to my larger App Store Icon. Yup, thats happened before =)
There’s also a video covering these same issues for those awesome folks that bought my Artist’s Guide to Making Apple Watch Apps. Or if you’re a subscriber of the site, that same video is filed under both the course and the Developers Survival Guide.