Xcode won't recognize my new provisioning profile

前端 未结 9 2065
情歌与酒
情歌与酒 2020-12-15 05:15

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 Xcod

9条回答
  •  -上瘾入骨i
    2020-12-15 05:47

    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.

提交回复
热议问题