0

As suggested in this: https://github.com/KrauseFx/fastlane/blob/master/docs/CodeSigning.md

I opened the project.pbxproj of my project and searched for statement like this -

PROVISIONING_PROFILE = "";

Strangely there was no variable defined for provisioning profile. I ensured that the setting was automatic under the build settings in xCode. I checked few other projects as well, such a statement was missing. What is causing this? Also if I manually want to add the statement PROVISIONING_PROFILE = ""; where should I place it in the project.pbxproj file.

Sarthak Singhal
  • 665
  • 2
  • 10
  • 26
  • This link will help you. http://stackoverflow.com/questions/1760518/codesign-error-provisioning-profile-cannot-be-found-after-deleting-expired-prof – Nimisha Patel Jul 20 '15 at 08:10
  • @NimishaPatel Yes, already looked at it. In my case the variable is not present at all in `.pbxproj` file. – Sarthak Singhal Jul 20 '15 at 08:11

2 Answers2

0

Look for the section that begins with XCBuildConfiguration. You will need to add it for each build config in your project:

/* Begin XCBuildConfiguration section */
    8C822CD8279123D91163DD34 /* Release */ = { 
        isa = XCBuildConfiguration;
        buildSettings = {

                CODE_SIGN_ENTITLEMENTS = "";
                CODE_SIGN_IDENTITY = "iPhone Distribution: Company Name, Inc";
                "CODE_SIGN_IDENTITY[sdk=iphoneos4.2]" = "iPhone Distribution: Company Name, Inc";
...
                PROVISIONING_PROFILE = "";
                "PROVISIONING_PROFILE[sdk=iphoneos4.2]" = "";
                SDKROOT = iphoneos;
                TARGETED_DEVICE_FAMILY = "1,2";
        };
        name = "Release";
    };
wottle
  • 13,095
  • 4
  • 27
  • 68
0

The absence of PROVISIONING_PROFILE is the equivalent of Automatic -- having this value set to anything but empty (the value would be a UUID) indicates you intend to use the specific provisioning profile who's UUID matches the value of PROVISIONING_PROFILE.

In most cases, you want to use the Automatic setting which would manifest as either the empty PROVISIONING_PROFILE line or not having that line present. Automatic allows you to update, download, and install newer versions of your provisioning profile without having to update your build configuration each time you add a new test device, enable a new entitlement-based service, or simply reissue the existing profile.

Provisioning profiles are stored on-disk as .mobileprovision, the default sort order is alphabetic. When using Automatic, the following rules are used to select profile to sign with -- the first profile that matches wins:

  • Profiles with an explicit AppId (com.mycompany.mydivision.myapp) precisely matching the current project's AppID
  • Profiles with a wildcard (com.mycompany.mydivision.*) AppId matching the longest component of the reverse-DNS styled project AppID
  • Profiles that are pure wildcard (*)

If you must use a specific profile, do keep in mind that each time you edit a provisioning profile on the Certificates, Identities, and Profiles tool you will download a new version of the provisioning profile -- this profile's UUID will be different and as such you will need to update your build settings each time you make a change. If you work with a development team, simply adding a new developer's certificate to the provisioning profile will cause a new UUID to get generated and may cause code signing errors for one or more members of your team.

Bryan Musial
  • 8,340
  • 2
  • 43
  • 50
  • But why some project does not have `PROVISIONING_PROFILE` variable at all and some have a blank entry like this - `PROVISIONING_PROFILE = "";` in the `.pbxproj`, although in both cases the setting is `automatic`. – Sarthak Singhal Jul 24 '15 at 18:13
  • 1
    It depends on how the build configuration has been changed; setting it to an explicit value will add the entry to the project, then setting back to Automatic will blank the value out. For those developers that manually inject that setting key, the behavior is different. The net result is that omitted key or blank value are both treated as Automatic in the current shipping version of Xcode. Apple, as always, reserves the right to change that meaning at any time! – Bryan Musial Jul 24 '15 at 18:16