Cannot export developer ID signed Mac app - xcode

I am trying to build an update to my Mac app. As usual, I clicked Product>Archive then, in the Organiser, I clicked Distribute...>Export Developer ID-signed Application. Xcode finds my Developer ID, but it fails with the error "Code signing operation failed - Check that the identity you selected is valid."
This has never happened before, so I'm at a bit of a loss - I most recently exported a version of my App last week.
The only things that have changed are:
I have changed my Apple ID password
I added Cocoapods to my project and I'm now using the .xcworkspace file, rather than the .xcodeproj file.
I've tried refreshing the Teams list in the Xcode organiser, deleting all my Mac development and distribution certificates, restarting Xcode, and asking very nicely, but I'm still getting the same error.

You've done the right part in xcode, the only place that might be the problem is the Dev portal. Check your Dev certs in there if needs be you may have to remove those and request them again then sync them with xcode. That has worked for me before and might work out for you.

In case anyone ends up here, but still has the problem after checking everything in the dev center,
try removing extraneous files form the project. For me these were:
Gruntfile.js, karma-e2e.conf.js, karma.conf.js, and the entire node_modules directory.
see: How to build IPA for distribution with TestFlight with XCode 5?

Related

How do I find why Xcode no longer notarizes my app?

I have a MacOS app that I last notarized about a year ago with no issues. This time, however, when I created the initial Archive, the Organizer put it into a section called 'Other Items' instead of in the 'macOS Apps' section with all of the previous Archives. In addition, and more distressingly, when the Archive is selected, the button says 'Distribute Content' instead of the expected 'Distribute App', and pressing it simple exports the Archive or its contents, without running through the automatic notarizing process.
I suspect I have done something in the last year that somehow invalidates my app such that Xcode no longer recognizes that it is an app. I have followed the suggestions at https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/resolving_common_notarization_issues, but that did not provide any relevant clues.
I am using Xcode Version 13.4.1. How do I figure out what is preventing Xcode from offering to notarize the app?
To track this down, I created a new project, and then tried to notarize it. (I didn't actually notarize it, I just made sure that I could Archive it and it showed up in the correct section in the Organizer.) The new project archived as expected, so I knew that I could still notarize somethings; I was just having an issue with my app.
My plan was to copy items from my app into the new project in small chunks, and after each copy, attempt to Archive it. I figured that I would either find the item that was causing the failure (and fix it), or I would eventually copy the entire app without a failure. Either way, I would be able to notarize the app.
The first chunk I copied was all of the build settings. And right there, the new project would not notarize, so I removed and added build settings to binary search which setting was causing the failure. It came down to the RUN_DOCUMENTATION_COMPILER = YES build setting.
In the last year I have been more conscientious about documenting the code, and to actually see that documentation, I had added that build setting.
Comparing the archives created with and without running the documentation compiler, the MyApp.doccarchive file appears in the archive in the Application folder along side MyApp.app, so it appears that Xcode is confused by the "extra" file in the Application folder.

Xcode having issues with sign certificates

I was still using Xcode 7.X, so I updated it to 8.2.1 by downloading the latest version from the App Store.
Now Xcode seems unable to load certificates. When I open my project (Mac app), in the MyApp.Xcodeproj viewer, in the Signing segment, there is the loader (spinner), and it won't go away.
When preparing the package for App Store distribution the validation process fails as it says that sandboxing is not configured. However I am sure it is, as this very app is in the Store.
EDIT I've completely removed Xcode (inclusing com.apple.dt.** files) and reinstalled it, the problem persists, but only with this particular app. Creating a new app does load the signing section.
Try to reset the the certificates and profiles in the XCode Account manager like:
XCode > Preferences > Accounts > The Apple Id > Double Clic the Team Name > Reset all and Download all
Also can be useful to check if unchecked the "Automatically manage signing" in the General Tab of the Application and make sure you have the correct Apple ID selected.
Remove your Apple ID from your Accounts list and then add your Apple ID back to the Accounts list.
Xcode > Preferences > Accounts > Select Account > Click the minus symbol
Xcode > Preferences > Accounts > Click the plus symbol
The solution was unexpected: out of options, I simply created a new project (with a different name). The idea was to copy all code and working settings to start fresh.
As I begun the process the "new" app was working, so I renamed the project as my actual app and then I opened the old project to copy some xcode settings. With my surprise, now the Signing section was working again also in the old app.
So I figured that I could delete the "new" app. However, after deleting the new app, the old one stopped working again (spinner in signing section), this time also mentioning that it was unable to locate certain files that were in the new app folder.
I recovered from the bin the new app, and finished the transition of all settings. Now everything is working again.
My assumption (not verified) is that some config files deep in the OS were conflicting with signing setting for this particular project (as identified by its name), so when I renamed the new app with the same name of the broken project I must have overwritten such broken setting.

2 Ad Hoc Distribution profiles with same name listed when I build my ipa

This stuff still confuses me. I added a device to my Ad Hoc profile in the developer portal, downloaded and double clicked the downloaded file. Nothing appeared to hapopen so I went into the Organizer in xCode 5, selected Editor->Provisioning Profiles->Import Profile.
Now when I build my ipa for distribution the profile is listed twice. I picked the first one in the list and discovered that it did not have the new device, so I redid the build, picked the second one and it worked as expected.
I do not understand exactly why I have gotten myself into this situation nor how to remove the old profile.
Here is what my code signing in xcode looks like. Should I delete and start over. If so which ones do I delete?
Thanks,
John
The best way to do this in XCode 5 is using an iPhone Configuration Utility. It lets you manually delete duplicates of provisioning profiles with ease and speed.
I keep Xcode closed when I do this just in case.

Adding an unattached UDID to existing project in XCode

Sorry, I'm sure this question is quite basic, but from what I've read I'm doing it correctly and still not having any luck.
I have a project in XCode. It compiles correctly and I can install it ad-hoc on all the devices that were originally part of the provisioning profile I created when I first started the project.
I now have another UDID that I need to add so they can test. They live on the other side of the country, so I can't attach the device and add it through XCode.
So from my understanding, these are the steps I have taken:
Over at developer.apple.com, add the UDID to the device list.
Update the provisioning profile on the developer website to include the added UDID.
In XCode, open organizer, select provisioning profile and hit refresh.
Recompile.
Am I missing a step in there? It recompiles fine but apparently won't install on the added device.
EDIT: I found This Post, which sounds like what I want, but I can't find the checkbox for "Automatic Device Provisioning". Where is that located?
It seems that the "Automatic Device Provisioning" checkbox has been removed from later Xcode versions, check this question: The Automatic Device Provisioning options have gone since upgrading to Xcode 4.3.1?.
The steps you listed seem good. You could check if the new profile has been effectively inserted into the ipa file:
- rename the .ipa in .zip;
- navigate into Payload and then contents of the .app package;
- open the embedded.mobileprovision file with a text editor;
- search for the new UDID string inside the file.

Xcode 4.2 IOS 5, Cant select provision in Target

I am having a weird issue with my profiles. For my project, i have all the provisioning profiles in order. Developer, Distribution & Release, everything seems to be fine, no errors, no discrepancies in keychain or organizer.
However, i am able to select the correct profiles, Developer and Distribution for the project settings; but for the target settings i cannot select the distribution profile. They are greyed out and show "does not match application identifier" message. But my bundle identifier is exactly the same (case sensitive) as i have created it in the portal.
I have tried removing and adding the profiles; still the same.
One thing, i noticed however is - when i try using "Automatic Provisioning" from xcode it is removing adhoc and appstore profiles from the portal; i have no idea why.
Again, my bundle identifiers are correct, i picked the correct app in the portal.
any suggestions are highly appreciated.
After digging through my old project and comparing it with the current one; i have noticed the project name being added to the bundle identifier. So effectively my bundle identifier is becoming something like com.veeru.mface.mfaceproject where as xcode expects it to be com.veeru.mface only.
I had to remove the {BUNDLE IDENTIFIER} attached to the bundle id project's plist and xcode immediately saw the profiles properly.
Caught me by surprise cause i never had these issues previously; And still cant' figure out why xcode removes my profiles when i do a "Automatic provisioning" refresh.

Resources