问题
My app's development provisioning profile expired a couple of weeks ago, so I went to the provisioning portal to get a fresh new one. After obtaining it, I visited the Xcode Organizer, removed the expired profile from my devices as well as my Mac, then imported the new profile. Xcode installs the profile onto my devices immediately, and my app runs again on the devices.
The problem is that while the Organizer is able to see the new profile and install it as normal, the IDE gets confused between the old one and the new one. Every time I try to build the app, it fails immediately. The error console tells me that Xcode can't find the old profile, because the GUID listed belongs to the old one. That's strange; I thought Xcode would've been aware of the new profile by now.
I've tried removing the new profile from my devices and my Mac, then reinstalling the profile. Doesn't work, Xcode is still trying to look for the old one. I've also tried selecting a different profile to make Xcode forget the old one, then selecting the new one. I've even tried manually entering the GUID of the new one in the Other choice. Yet Xcode still insists on looking for the old profile, which by now is already gone from my Mac.
How do I convince Xcode that I've generated a new provisioning profile for my app for it to use?
回答1:
tl;dr: turns out I simply had to edit the project file manually to tell Xcode of the new profile. Now, I don't know why I had to manually update the project file. Perhaps I did something wrong during the process of importing the new profile to Xcode, so it didn't realize my new profile had come in. Or the file system choked midway and Xcode wasn't able to update itself. Oh well.
Now for the fun technical part:
IMPORTANT: As with anything else that involves modifying files you shouldn't be modifying: make sure to back up your
.xcodeproj
bundle and/or your entire Xcode project, or make sure your Xcode project is kept in proper version control. You don't want to mess up and cause Xcode to stop building your project onto your device, without anything to fall back on.
I peeked into the contents of my app's .xcodeproj
bundle (Xcode is not running at this time). To view these, open your project folder in Finder, then Control-click on your .xcodeproj
file and choose Show Package Contents:
Breeze.xcodeproj/ Daniel.mode1v3 Daniel.pbxuser project.pbxproj
Then opened project.pbxproj
in a text editor (it's text, not binary), and looked around for build configuration information.
There's a section labeled /* Begin XCBuildConfiguration section */
(which you can find using your editor's search function). It's a list of entries, each of which represents a code-signing configuration for a given profile in a given build configuration.
Here's information about the profile I use to sign my binary for development:
1D6058940D05DD3E006BFB54 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Daniel Tan (XXXXXXXXXX)";
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Breeze_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvmgcc42;
INFOPLIST_FILE = "Breeze-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
PRODUCT_NAME = "Breeze";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "36F99F3E-805F-47A7-95D4-FF8324711CBE";
SDKROOT = iphoneos;
};
name = Debug;
};
Of note is this line:
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "36F99F3E-805F-47A7-95D4-FF8324711CBE";
That's the GUID reported by the build error; the identifier of my old, expired provisioning profile.
All I had to do was replace it with the GUID of the new profile:
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "E6E6369E-FD58-4886-9C3A-72C9DAE36501";
I open my project in Xcode again, and now my app builds and installs on my devices successfully, using the new provisioning profile.
回答2:
Here's how I did it in Xcode 4:
- Select Don't Code Sign from Project > Build Settings > Code Signing
- Clean the build
- Build it again - should show an error like "this stuff needs signing"
- Choose the new profile from the Code Signing
- Rebuild
回答3:
I was able to fix this error by changing it to "Don't Code Sign" in Code Signing Identity. Build, and you get the error "code signing is required for product type ...blah...". Then go back and select the right profile. Build and all good. This happened to me because my certificate expired and I renewed it. In addition to the above I also had to remove the old certificate from my keychain, and the Organizer.
回答4:
- Close de xcode
- edith with texmate, youtproject.xcodeproj
- Find this line
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "E8DEEBA3-FE0A-419F-9F7E-258572D55807";
- Erase
- Restart xcode build & archive for enterprise
回答5:
To add to the solution above, you can use the lovely xcodeproj gem to help with stuff like this. Note, it does convert your OpenStep key = value;
-style plist to XML. Note: I have found that Xcode changes it back if you make project file changes in Xcode later. Either style of file builds fine either in Xcode or from the command line. For a sample of how I use it
project = Xcodeproj::Project.new('Foo.xcodeproj')
csi_key = 'CODE_SIGNING_IDEDNTITY'
project.targets.each do |target|
target.build_configurations.each do |conf|
conf.build_settings[csi_key] = 'iPhone Developer: Cool Dood (XYZ123)' unless conf.build_settings[csi_key] == nil
end
end
Here's a gist of how I use it: https://gist.github.com/82times/5594887
回答6:
My solution to this problem was:
- Download your new provisioning profile
- Double click the provisioning profile to install it
- Go to the following directory on your mac:
/Users/<your.username>/Library/MobileDevice/Provisioning Profiles
- Find the old provisioning profile that you no longer want (but keeps showing up in Xcode). This may come in handy for this step: https://github.com/chockenberry/Provisioning
- Delete it
- Completely exit Xcode
- Reopen Xcode
- You should now be able to select your new provisioning profile
回答7:
In my case, with XCode 5, when my developer certificate expired, I ran into this issue. I manually downloaded the new certificate and new provisioning profile. I added the certificate to the keychain and the provisioning profile to the devices in organizer.
However, XCode kept complaining that I cannot sign the app. I figured that in XCode 5 preferences, it still displayed the old provisioning profile and it didn't refresh to the the new one despite numerous reloads that I did there.
Eventually, I used iPhone Configuration Utility to delete the old provisioning profile and add the newly downloaded provisioning profile. After code signing worked as expected.
回答8:
I thought that double clicking on the downloaded provisioning profile would place it into xCode Organizer Archive, but that just wouldn't work for me. The following steps finally worked for me.
- Open xCode
- Go to Product -> Destination -> iOS Device
- Go to Product -> Archive
回答9:
Most answers did not work for me as they seem to be for older versions.
For Xcode 8.3.2:
- Xcode->Preferences->Accounts
- Select Apple ID
- Double-click your Team
- Click the '+' dropdown in the bottom left to "Create a certificate"
- Choose iOS Development
- Click 'Done'
After doing this I was able to tell Xcode was using the latest profile by clicking the 'i' info icon next to "Xcode Managed Profile" under Targets->General->Signing and confirming that the 'Created' date reflected the new one.
来源:https://stackoverflow.com/questions/5291463/xcode-wont-recognize-my-new-provisioning-profile