iMedia & Xcode 8 code signing

4 views
Skip to first unread message

Peter Baumgartner

unread,
Nov 9, 2016, 4:41:05 AM11/9/16
to imedi...@googlegroups.com
Abstract: A method to make sure that iMedia can be built and code signed with Xcode 8 while still being backwards compatible with Xcode 7 based build workflows



Hi everyone,

As you may know Xcode 8 has dropped new code signing workflow on us, which requires setting the development team in the General or Build settings tabs in Xcode. This is fine for our own application projects, but this approach doesn’t work for an open source framework that is shared by multiple host applications from different developers. 

Since iMedia contains several XPC services with various different entitlements, code signing at compile time is essential. Our current build workflow stopped working with Xcode 8. I have been researching and thinking about this issue for a while now, and came up with a reasonable workaround to this problem. My proposed solution looks like this:

1) First I removed all traces of code signing settings from the Build Settings inspector in iMedia.xcodeproj.

2) Next I moved the corresponding settings to the file “iMedia.xcconfig”.

3) The values in this xcconfig file are designed to be compatible for building with Xcode 7 without modifications.

4) The xcconfig file also contains build setting variables that are only relevant to Xcode 8 - PROVISIONING_PROFILE_SPECIFIER and DEVELOPMENT_TEAM

5) Both are set to empty strings, meaning “automatic” provisioning and “None” set as the development team. This will cause building to initially fail with Xcode 8, because it requires the development team to be set!

6) Now comes the important part: #include "../DevelopmentTeam.xcconfig” . This includes a separate xcconfig file just outside the iMedia repository (one directory level higher), that the developer can create and edit. Simply override the value of DEVELOPMENT_TEAM  with your own team ID.

7) After throwing away your build folder, closing and reopening the project (Xcode is fairly aggressive in caching all sorts of information), iMedia will build and code sign just fine in Xcode 8.

Here’s all the relevant xcconfig code again:


    // Use "Mac App Store" code signing identity

    CODE_SIGN_IDENTITY = Mac Developer

    // Xcode 7 doesn't require the development team to be set. The setting "None" in the popup menu is just fine
    // to build this project. Xcode 8 however requires the development team to be set or code signing won't work.
    // It also introduces the new variable "DEVELOPMENT_TEAM", which is not used by Xcode 7. So we'll define
    // it here with an empty string ("None"), so that Xcode 8 fails to build out of the box. This is intentional.

    DEVELOPMENT_TEAM = // "None"

    // The following line includes the file DevelopmentTeam.xcconfig, one folder level higher, just outside of the
    // iMedia git repository. In this file each developer using iMedia can override the value of DEVELOPMENT_TEAM
    // with his or her own team ID. That way iMedia can build under Xcode 8 again.

    #include "../DevelopmentTeam.xcconfig"

    // Select automatic provisioning profile.

    PROVISIONING_PROFILE = // "automatic" for Xcode 7
    PROVISIONING_PROFILE_SPECIFIER = // "automatic" for Xcode 8


A typical folder layout for an application using the iMedia.framework might look like this. Here iMedia and OtherFramework are git submodules in the MyApp git repository. As you can see, the file DevelopmentTeam.xcconfig is one level above the iMedia git repositiory, just inside the MyApp git reposittory - and will thus be committed with the MyApp source code - just what we want in this situation. If OtherFramework is also an open source framework with a similar problem, it might even use the DevelopmentTeam.xcconfig file, too...


    MyApp
     .git
     MyApp.xcodeproj
     MyApp.xcworkspace
     DevelopmentTeam.xcconfig
     ...
     iMedia
     .git
     iMedia.xcodeproj
     ...
     OtherFramework
     .git
     OtherFramework.xcodeproj
     ...


I already talked to Jörg about my proposed solution and he is fine with it. This is currently committed and pushed in the branch “Xcode-8-signing” for you to try out. If there are no objections by those of you who are using iMediaSandboxing, we would like to merge this back to the “development” branch, so that we can migrate to Xcode 8 as soon as possible. Swift 3 and Touch Bar are beckoning…

Cheers,
Peter

Reply all
Reply to author
Forward
0 new messages