简体   繁体   中英

Unable to archive project with xcodebuild command: code sign error, missing provisioning profile?

I'm using Xcode 6.4 and the associated command tools. I'm trying to archive to create the ipa of my app with the command:

xcodebuild -scheme MyScheme -archivePath MyProjectName archive

But I get this error message:

Check dependencies Code Sign error: No matching provisioning profile found: Your build settings specify a provisioning profile with the UUID “xxxxxxxxxx”, however, no such provisioning profile was found. CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 8.4'quote

But the UUID that is said in such message, is not the UUID of the provisioning profile I've set in the target`s build settings > code signing > Provisioning profile. In fact, I don't know what provisioning profile this error message is talking about... is there some other place in Xcode where the provisioning profile is set and I haven't noticed it? How could I check what provisioning corresponds to such UUID?

Thanks

This would very much depend on how you have your project's build configuration setup, if you are inheriting build configurations from other .xcconfig files, and any automation you may have in place that dynamically rewrites your project's .pbxproj file. That said, Xcode also can get itself confused while it attempts to straighten up the .pbxproj and could have left something lingering.

  1. Quit Xcode.
  2. Navigate to your source files, and look for your .xcodeproj (not the .xcworkspace but the actual Xcode Project file itself).
  3. Right click on it and select 'Show Package Contents'.
  4. In your text-editor of choice (I use BBEdit or the free version TextWrangler), open project.pbxproj
  5. Search the entire pbxproj file for PROVISIONING_PROFILE

I suspect that you'll have an entry in one or more XCBuildConfiguration blocks that resemble this:

/* Begin XCBuildConfiguration section */
7D433CD8275123D91263DAA4 /* Release */ = { 
    isa = XCBuildConfiguration;
    buildSettings = {
            CODE_SIGN_ENTITLEMENTS = "";
            CODE_SIGN_IDENTITY = "iPhone Distribution: Your Name Here";
            // Other settings would go in here
            PROVISIONING_PROFILE = "";
            SDKROOT = iphoneos;
            TARGETED_DEVICE_FAMILY = "1,2";
    };
    name = "Release";
};

One of these configuration blocks may contain multiple PROVISIONING_PROFILE settings or you might just find the one line that exactly matches the UUID specified in your error. That would look like PROVISIONING_PROFILE = "xxxxxxxxxx";

In either case, take care to backup your .pbxproj file (it is in source control, right?) then delete the offending line(s) which will revert you back to Automatic Profile Selection, finish searching for other instances of that same offending line, save all of your changes, quit your text editor and reattempt the command-line build.

If you have intentionally set a specific UUID for the PROVISIONING_PROFILE setting in the past, do be sure to reverify your code sign settings in Xcode as you could easily undo an intentional setting by removing all instances of PROVISIONING_PROFILE and falling back to the Automatic mode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM