How to prevent Xcode 8 from saving "development team" in .pbxproj?

msc picture msc · Sep 23, 2016 · Viewed 9.4k times · Source

Xcode 8 demands you select a "development team" before you can sign your apps for both iOS and macOS. It wasn't very difficult to figure how to make the selection. (Answer can be found in Add developer team in Xcode 8? in case anyone can't figure it out themselves.)

The problem is that Xcode saves the selection in the .pbxproj file. Since in my case, and I expect many others, this is under SCM, and the project is used by many unrelated people & teams, this is a huge problem. For example 'git status' shows the work area is not clean as soon as the team has been selected.

Is there a way to either

  • get Xcode 8 to save the selection in user rather than project data, or
  • specify a default "development team" for all Xcode projects?

Answer

0xced picture 0xced · Nov 4, 2016

You can abuse Xcode’s Custom Paths mechanism to store your development team identifier outside of the project.pbxproj file by setting a DEVELOPMENT_TEAM custom path (replace ABCDEFGHIJ with your team identifier):

Xcode Custom Paths

(Xcode menu → Preferences… → Locations → Custom Paths)

The custom paths are stored in Xcode’s preferences (IDEApplicationwideBuildSettings and IDESourceTreeDisplayNames).

But there’s a catch! Unfortunately, as soon as you change anything in the project (update a build setting, add a new build phase, rename a target etc.) the development team will be automatically added to the project.pbxproj file (in the TargetAttributes of the project object). This requires constant care not to commit those changes.

If this practice of setting your DEVELOPMENT_TEAM as a custom path gains traction, open source project owners will be able to not specify any Development Team nor Provisioning Profile, set the Code Signing Identity for Any iOS SDK to iOS Developer ("CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";) and open source demo apps will build and run on any device just like it did with Xcode 7. 😃