In the middle of developing an app, I was asked to switch to a different developer account, which resulted in adding a new app ID and creating new provisioning profiles for adhocs on the new account, as well as updating the XCode settings to sign with the new identity.
The problem is that somewhere, somehow XCode is keeping the old provisioning profile around.
I.e. I had a distribution profile "OLD". I created a "NEW". I deleted "OLD" from Organizer in XCode. When I build and archive, "OLD" REAPPEARS in XCode's Organizer, and the adhoc doesn't work for people.
I've tried doing a
grep -r "AD67EE83" *
in the trunk directory for the app, where "AD67EE83" is the profile id in the Organizer. I get a bunch of results in the build directory that look like this:
build/myapp.build/Adhoc-iphoneos/myapp.build/build-state.dat:N/Users/me/Library/MobileDevice/Provisioning Profiles/AD67EE83-BLAB-LABLA-BLAB-LABLABLABLAB.mobileprovision
build/myapp.build/Adhoc-iphoneos/myapp.build/build-state.dat:CProcessProductPackaging "/Users/me/Library/MobileDevice/Provisioning Profiles/AD67EE83-BLAB-LABLA-BLAB-LABLABLABLAB.mobileprovision" /Users/me/Documents/svn/myapp/trunk/build/Adhoc-iphoneos/myapp.app/embedded.mobileprovision
build/myapp.build/Adhoc-iphoneos/myapp.build/build-state.dat:x/Users/me/Library/MobileDevice/Provisioning Profiles/AD67EE83-BLAB-LABLA-BLAB-LABLABLABLAB.mobileprovision
build/myapp.build/Adhoc-iphoneos/myapp.build/build-state.dat:lSLF07#2#192"ProcessProductPackaging "/Users/me/Library/MobileDevice/Provisioning Profiles/AD67EE83-BLAB-LABLA-BLAB-LABLABLABLAB.mobileprovision" build/Adhoc-iphoneos/myapp.app/embedded.mobileprovision303990620#303990620#0(0"0(0#0#108"/Users/me/Documents/svn/myapp/trunk/build/Adhoc-iphoneos/myapp.app/embedded.mobileprovision8628715392#445" cd /Users/me/Docume <com.apple.tools.product-pkg-utility> "/Users/me/Library/MobileDevice/Provisioning Profiles/AD67EE83-BLAB-LABLA-BLAB-LABLABLABLAB.mobileprovision" -o /Users/me/Documents/svn/myapp/trunk/build/Adhoc-iphoneos/m0#p.app/embedded.mobileprovision
(I replaced the actual ID with BLABLA there, in case you wonder about that.)
In any case, OLD is pulled out from somewhere and restored and used. Insane. I deleted in Organizer and searched my disk for that AD... thing and found a few files in /Users/me/Library/MobileDevices/Provisioning Profiles/ which had the same names.
I deleted those and it still pulls them out from somewhere when i Build & Archive. In fact, those files are put back in that directory as well.
I've gone through all the settings trying to find any reference to this AD... profile, but there's none anywhere.
OLD is tied to "com.oldcorp" and NEW is tied to "com.newcorp" -- doing a grep 'newcorp' reveals
myapp-Info.plist: <string>com.newcorp.myapp</string>
Doing a grep 'oldcorp' gives no results.
Any ideas where it might be referring to this old invalid cert? (It's even removed from the developer portal, so I don't think it's possible for it to download it from Apple directly.)
Update: building and archiving ANY project results in the resurrection of the "oldcorp" distribution profile, so it's not related to my project. Problem remains though - adhoc is non-functional.
Solved this by recreating a project and manually putting code in. Long term solution is in answer below.
I create new User accounts on my Mac when dealing with different developer accounts to prevent XCode caching from creating these types of messes.
That might still provide you with a solution. Create a temporary fresh new User account, install only the private keys, certificates and provisions needed for the new developer account in the new User account, make sure not to use any shared user directories in your build settings, check out your project from source control into the new user account, and run Xcode for your Ad Hoc builds there.
Related
I am trying to figure out a better way to transfer bundles within our company and to multiple clients account. Which one will be the better way to install a bundle and later update it - Copy or Push? What are the limitations?
Copy is intended for versioning, deprecation and release testing.
You can think about copy as Forking a Project.
When coping a bundle, it will get a new bundle number and will appear on the bundle list.
If you want to move the bundle to client accounts, you have to install/push it on their accounts, never copy.
Something bad happened to my sprite kit project. I was working on my first ios game, and I've got most of it done. But then today, I somehow see that my game scene swift file was gone. There is no way that I can open or have the file back on the project again. The file marked in red in the picture is the missing file.
Screen Shot of Xcode project
Some one Please Help!
Time Machine
Use Time Machine (use Spotlight Search) to go back in time to when it wasn't deleted.
Source Control
If created, go into your source control provider (XCode, BitBucket, GitHub, etc) and make a pull request from a previous commit.
Snapshots
If you snapshotted the project, go back through them to find when it wasn't deleted.
Finder
Check all the files inside of where you saved the file. It is possible you only removed the reference of the file and not deleted it. Use spotlight search if necessary. Check the Trash bin on Mac.
Tips For Future Projects
Use source control, such as ButBucket or GitHub. XCode has a built in one as well. You can also use Time Machine, a built-in app that captures everything on your mac every couple of hours so you can go back in time and pull anything you need back (even trashed items).
I have a big problem. One of my coworkers left the company yesterday and one of his projects went into my hands. We work for a company which set up a TFS for us to work together on one big project. He accessed the TFS by using his LiveID. When he left yesterday, he hasn't checked in his new/updated items and I forgot to do it today before I disconnected him and logged in with my account.
So basically I still have the updated solution on my local hard disk. But since my workspace is mapped to another folder, it actually downloaded old versions of our code files.
How can I copy the updated, not-checked-in items into my local workspace folder and check them in?
UPDATE: I have tried changing the local workspace folder by going to File --> Source Control --> Workspaces but I get another error telling me that the folder I'm trying to map (the one used by my ex-coworker) belongs to somebody else.
The easy way would be to log in as him, but a it is a Microsoft ID rather than an AD account you are kind of scuppered there. You o however have the files from disk. If you copy the files from his workspace and drop them over the top of your workspace TFS will detect the adds and edits for you. You will then have to go through and look for any deletes yourself..
a...make sure it builds, run all your unit tests, and then check in.
I had another issue which I believe got solved here.
Now I have an issue with a Provisioning Profile:
During the previous issue, I deleted the iOS keys in my Keychain. During the archive process, Xcode retrieved them for me, same with the certs.
I created this Provisioning Profile, downloaded, and I have double clicked it to add it, but I keep getting this error when trying to validate.
Any ideas?
If all else, fails, how can I wipe everything clean and start over?
It looks like the certificate you created became invalid because you deleted the private key. Unless you kept a backup somewhere, you should log in to the development center, delete this certificate, and then create a new one.
If you deleted the private key it is gone forever. Your developer account only has the public key to keep the private one from being stolen off the servers. The best thing to do when creating provisioning profiles is to save a copy of the private key (you can export from Keychain Access.app) and store them with a copy of your profiles, etc from Xcode. That way if you change machines or add a new machine you can still use the same profiles.
I have two Team provisioning profiles which I need.
The automatic selection picks the wrong one for me at the moment.
I can't force it to use a specific one, because that choice gets submitted to svn.
Is there a way to influence the automatic selection?
I figured out that XCode picks the Team Provisioning Profile that was last added.
So, When you need to change the default picked profile, just reinstall it on your machine.
The defaults are chosen based on the bundle identifiers associated with each profile. You might think that the selector would choose the most specific identifier which matches your project, but this is not the case.
The selector chooses any profile which matches your project, with a preference for the most distant expiry date. The selection can therefore be shifted by generating your profiles in a specific order. The most recently generated profile will have a slightly later expiration date, and will therefore be preferred over older matching profiles.
(paraphrased from retrodreamer)