Skip to content

xcode: support no preselected profile #1

@lacostej

Description

@lacostej

Today we can only update a profile instead of automatically one it it isn't properly selected. It should be possible to select a profile automatically instead.

There are a few problems to solve:

  1. I ve failed to implement a working command line pbxproj editor properly using plistBuddy and I am currently using sed
        echo "INFO Replacing ${current_pp_uuid} with ${new_pp_uuid} in $file"
        # this doesn't work as it converts the file into XML and we lose the comments
        # echo ./pbxproj_pp_uuid.sh $file "$configuration" set $new_pp_uuid
        sed "s/${current_pp_uuid}/${new_pp_uuid}/"  ${file} > ${file}.new

This should have called something like

        $plistBuddy $file -c "Set objects:${buildConfigurationObjId}:buildSettings:PROVISIONING_PROFILE[sdk=iphoneos*] ${new_uuid}" 2>/dev/null

but didn't work in my tests. At least, it converted the file to XML and I wanted to keep the original format in order to ensure the config wasn't changed elsewhere.

You can test this using something like

./pbxproj_pp_uuid.sh project.pbxproj 'Ad Hoc' set 9274AB2A-6F96-4BFF-B320-------------

Now XCode may still be able to read XML so this is perhaps not such a big problem.

But for the selection to work, one needs to modify more than just the value of the PROVISIONING_PROFILE.

These are the changes in the project file when I manually go from the default selection to a particular PP:

--- ../project.pbxproj  2012-02-23 10:48:51.000000000 +0100
+++ /Users/lacostej/Code/WWTK/DE.git/target/DragonBox_IOS/Unity-iPhone.xcodeproj/project.pbxproj    2012-02-23 10:57:53.000000000 +0100
@@ -535,7 +535,7 @@
                    armv6,
                    armv7,
                );
-               "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+               "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: We Want To Know SARL";
                GCC_C_LANGUAGE_STANDARD = c99;
                GCC_ENABLE_CPP_EXCEPTIONS = NO;
                GCC_ENABLE_CPP_RTTI = NO;
@@ -547,7 +547,7 @@
                GCC_WARN_UNUSED_VARIABLE = YES;
                OTHER_LDFLAGS = "-Wl,-S,-x";
                PREBINDING = NO;
-               "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
+               "PROVISIONING_PROFILE[sdk=iphoneos*]" = "9274AB2A-6F96-4BFF-B320-------------";
                SDKROOT = iphoneos4.2;
            };
            name = "Ad Hoc";

So we would also need to modify the CODE_SIGN_IDENTITY. This isn't hard in itself, but today I am not managing certificate at all in neither the apple_dev_center.rb script nor the xcode related ruby & bash scripts.

https://github.com/quadion/iOSValidation is an interesting thing to look at for certificate management

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions