Well, many unclear things in Xcode, particularly to package and SIGN an app build. So in continuation of the previous posts with tips and tricks for newbies, here are some more.
How to take a screenshot
The very intuitive shortcut is Command + Shift + 3. The screenshot is then silently saved as a PNG on your desktop.
How to enable Product > Archive
The Apple help says somewhere “Archive your product for submission to iTunes Connect or for sharing with others”. They say you first need to configure archiving in your scheme, but the described way to reach the Scheme editor is a bit outdated: now (Xcode 7.2) it’s Product > Scheme > Edit scheme. Anyway, in there go to “Archive” and give a name to your archive, as they say.
The problem is, even after doing that, Product > Archive was still disabled/greyed out. As it turned out, that was because the scheme destination was a simulator instead of “Generic iOS Device”. This is configured near the “play” and “stop” buttons at the top of the screen, where you usually switch between simulators. See below:
Once the target is properly set to this, Product > Archive should be enabled.
How to change the build and version numbers
The only tricky part here is to FIND where this is. They are located in the Info.plist file of your project. The version is called “Bundle versions string, short” and the build number is called “Bundle version”.
How to get Xcode to automatically fix your signing certificates
I’ll just relate my experience here, as fixing the signing certificates and provisioning profiles seems to have as many solutions as people with the problem. In my case, another developer had produced and built the initial version of the application, and then I took over the project, with the provisioning profiles but the the certificates that go with them.
After finally managing to unlock the damned “Product > Archive” menu item, I went ahead and clicked it. I ended up, at first, with a pretty confusing error message, saying:
"Code Sign error: No matching provisioning profile found: Your build settings specify a provisioning profile with the UUID “8cda5448-xxxx-xxxx-xxxx-35c991b050b0”, however, no such provisioning profile was found". Searching for this, I got many “solutions” saying to copy
~/Library/MobileDevice/Provisioning \Profiles/) to various other locations, notably just
/Library/MobileDevice/ (sudo required, of course). None of these worked for me, but one mentioned the fact that this error message could be caused by a missing certificate (say, if the provisioning profile is found but the corresponding certificate is missing, you still get that error message, how clear!).
By the way, you can find the location of your provisioning profiles by going to Xcode > Preferences > Accounts, then pick your team and View details, then you can “Download all” (that button apparently replaced the previous “refresh” button), and also right-click on any provisioning profile and choose “Show in Finder”. Yay! (see tip below to display the full path in Finder)
I was preparing myself to just create a hefty load of brand new provisioning profiles, but first I gave a shot to Product > Build For… > Running. And well, it got an error too, but unlike “Archive”, it explained that I should either import the previous developer’s certificate that matched the provisioning profile, or reset it, and it gave me the option to do the latter automatically. I accepted and hurray, it just worked. Then I was able to run Product > Archive, and to find said archive in Window > Organizer
In the Organizer, I tried to Validate the archive. I don’t remember it 100% (after all my struggles, I wasn’t really in the mood to take notes, sorry), but I believe it tried to sign the app too, and failed but also proposed to automatically regenerated the provisioning profiles. Note, by the way, that around this time I got an e-mail saying the prod certificate was revoked (because a new one was generated). In the previous step of building the archive, the dev certificate met the same fate. But it worked, and I ended up with a ready to upload archive, brand new certificates, and regenerated provisioning profiles. Yay 🙂 I just had one problem left, cf next “mini chapter” below.
How to solve a failed archive upload saying “Cannot verify client. (3000)”
Well in my case that was simple, I just restarted Xcode. Others have mentioned that doing a clean and rebuild (and re-archive) did the trick, I’d advise you to start with a simple restart, it’s just faster plus we just built the archive already, so I’m not convinced rebuilding it would change much, unless you do restart before rebuilding.
How to display the full path to current folder in Finder
By default, when something sends you to a folder in Finder (like, when you ask Xcode to open the folder containing your provisioning profiles), it seems impossible to find out where the said folder is as the left panel doesn’t contain a proper folder tree unlike Windows Explorer. Gladly something can be done about it, although it’s not that convenient: use View > Show Path Bar (or Alt + Cmd + P) to add a bar at the bottom of the window with the full path to the folder. You can then also use it to reach a folder among the folder’s parents (double click it).