19

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?
Community
  • 1
  • 1
msc
  • 1,549
  • 2
  • 12
  • 19
  • 4
    According to https://pewpewthespells.com/blog/migrating_code_signing.html, all developers working on a project should be added to the same account / developer team "to avoid dirtying the project file". Clearly not logistically reasonable for an open source project, especially when people are using personal teams. Sure hope there is a better solution. – msc Sep 23 '16 at 23:28
  • Why not stick with the old code signing system? It still works fine. – Heath Borders Nov 02 '16 at 03:02
  • 1
    Well, you can't. Xcode 8 won't compile your target for an iOS/tvOS device if you don't explicitly choose a development team. This sucks for open source project that used to compile with Xcode 7 by picking a valid signing identity. – 0xced Nov 02 '16 at 07:52

2 Answers2

18

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.

0xced
  • 25,219
  • 10
  • 103
  • 255
  • This works. Thanks for solving this nasty problem. Fortunately the catch you mention is not an issue for me as my project generates the project.pbxproj files using GYP. Any changes must be made to the GYP files. I am delighted I did not have to go with my alternate solution of removing the project.pbxproj files from SCM and forcing my users to generate them themselves after providing their team identifier. – msc Nov 15 '16 at 07:21
  • I'm missing something. I followed the steps above, but not sure how to use this custom path. I set my team to None after creating this custom path, but the project won't build to my phone. – djibouti33 Feb 07 '17 at 20:50
  • 2
    I think I got it. Target > Build Settings > Development Team > Other > Add $(DEVELOPMENT_TEAM). If you go back to Target > General, you will see your team populated. If you open project.pbxproj in a text editor and search for DEVELOPMENT_TEAM, you'll see it's been set to "$(DEVELOPMENT_TEAM)". That being said, I was still able to find my Team ID by searching for "DevelopmentTeam", so I'm not sure if this solution will work for me. – djibouti33 Feb 07 '17 at 21:26
  • 2
    An alternative approach I've tried today is to store `DEVELOPMENT_TEAM=...` in an `.xcconfig` file, add that file to the project, but do not add it to version control (put it in `.gitignore` or whatever is the equivalent with VCS of your choice). – J. Williams Oct 25 '19 at 06:05
0

I upgraded my project from Xcode 7.3.1 to Xcode 8, and never set a Development Team or non-deprecated Provisioning Profile, and things still work fine.

enter image description here

Heath Borders
  • 30,998
  • 16
  • 147
  • 256
  • 3
    This is fine when all your team members have access to the *Twitch Development 20161017* provisioning profile which probably includes all the devices of the team. But this doesn’t work for open source projects which obviously can’t provide a provisioning profile. – 0xced Nov 02 '16 at 20:15
  • Yes, but you could set the deprecated provisioning profile as an xcconfig variable right? Then it wouldn't get overwritten. – Heath Borders Nov 02 '16 at 20:18
  • 2
    That’s not the the problem. The problem is that for an open source project, you can’t set a provisioning profile at all. Look at `ProvisionedDevices` of your *Twitch Development 20161017* provisioning profile in a text editor: it will only work for a few devices. In Xcode 7, you could set the Code Signing Identity to _iPhone Developer_, let the provisioning profile empty and Xcode would automatically pick your _iOS Team Provisioning Profile: *_. That’s not possible with Xcode 8 anymore. – 0xced Nov 03 '16 at 01:19