Xcode saves code signing info in the .pbxproj file. Any workaround?

277 views
Skip to first unread message

Mark Callow

unread,
Sep 22, 2016, 7:25:24 PM9/22/16
to gyp-developer
Xcode 8 enforces signing for macOS apps meaning it requires you to provide code signing info in a project's editor or the build will fail. This information is saved in the .pbxproj file. This means that after git checkout the info may be and after regenerating the projects with GYP it for sure will be lost and you have to re-enter it. This is a PITA. Does anyone know how to get Xcode to save the information in a .xcuserdata file or similar? Or another workaround?

This may have been an issue in earlier version of Xcode that I didn't notice because only iOS app signing was required and my branches did not until recently have different .pbxproj files.

Mark Callow

unread,
Sep 22, 2016, 7:39:34 PM9/22/16
to gyp-developer


On Thursday, September 22, 2016 at 4:25:24 PM UTC-7, Mark Callow wrote:
This may have been an issue in earlier version of Xcode that I didn't notice because only iOS app signing was required and my branches did not until recently have different .pbxproj files.

It couldn't have been an issue in earlier versions of Xcode because after I did enter iOS signing information, git status would show clean.  Now, of course, it shows all the .pbxproj files have been changed. Hugely irritating.

TJ Grant

unread,
Sep 22, 2016, 8:01:54 PM9/22/16
to Mark Callow, gyp-developer
Generic steps to find what you need to change in a GYP:

1. Create your GYP file
2. Run GYP on it
3. Open the Xcode project file in Xcode
4. Change the thing you need to change in it (your case, code signing)
5. Close Xcode, duplicate the file you just modified and rename it as a "copy"
6. Run GYP on your original again.
7. Run a diff against the outputted clean version vs the modified copy (I suggest the Xcode-provided "FileMerge" tool), and you'll find what you need to add, typically in the 'xcode_settings' block.

Cheat sheet for your situation, you can set the code signing stuff specifically like this:

'xcode_settings': {
.
.
'CODE_SIGN_IDENTITY': 'iPhone Developer',
'PROVISIONING_PROFILE': '',
.
.
}

To find what values you need to put in both of those key / value pairs, run the procedure I stated above.
iPhone Developer and {blank} should work in most cases, but are probably not the values you want in your case.

Good luck.

--

---
You received this message because you are subscribed to the Google Groups "gyp-developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gyp-developer+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark Callow

unread,
Sep 22, 2016, 11:35:42 PM9/22/16
to gyp-developer, marks...@gmail.com, tjg...@tatewake.com


On Thursday, September 22, 2016 at 5:01:54 PM UTC-7, TJ Grant wrote:
Generic steps to find what you need to change in a GYP:
...

I appreciate your effort to help. I am actually aware of all the  items you mentioned. BTW if you are using git, there is no need for steps 5 & 6. Simple replace step 7 with git diff.

The problem is that the gyp files and generated.pbxproj files are committed to a GitHub repo and are used by many people who are not members of a single team so cannot use the same signing credentials. Therefore embedding my signing credentials into a gyp file would not help, even if I was willling to do so.

TJ Grant

unread,
Sep 23, 2016, 1:07:15 AM9/23/16
to Mark Callow, gyp-developer
Hi Mark,

So have you tried using 'iPhone Developer' and '' (blank)?

If you use that pair then Xcode tries to "auto infer" the credentials to use at build time.

I'm actively using that pair for myself and an auto-building Jenkins instance and have had no issues with a transition from Xcode 7 to Xcode 8 on my end.
--
To:   
       



--TJ Grant
tjg...@tatewake.com

Mark Callow

unread,
Sep 23, 2016, 3:20:35 PM9/23/16
to gyp-developer, marks...@gmail.com, tjg...@tatewake.com


On Thursday, September 22, 2016 at 10:07:15 PM UTC-7, TJ Grant wrote:
Hi Mark,

So have you tried using 'iPhone Developer' and '' (blank)?


Yes. I have tried

    'CODE_SIGN_IDENTITY': 'iPhone Developer',
    'PROVISIONING_PROFILE': '',

Xcode 8 says 'Signing for "<projectname>" requires a development team.' Adding the blank provisioning profile, which wasn't there before, did not change the behavior. I added
    'DEVELOPMENT_TEAM': '',

but that didn't help either. When I choose a development team in the Xcode UI, the value of DEVELOPMENT_TEAM is set to an alphanumeric code, though strangely only in Release configurations. Xcode saves this in the .pbxproj file. Hence the problem.

I did not have this issue with Xcode 7. It handled things automatically using a signing id(?) that it had helped my set up. 

Mark Callow

unread,
Sep 23, 2016, 7:37:34 PM9/23/16
to gyp-developer, marks...@gmail.com, tjg...@tatewake.com


On Thursday, September 22, 2016 at 10:07:15 PM UTC-7, TJ Grant wrote:
I'm actively using that pair for myself and an auto-building Jenkins instance and have had no issues with a transition from Xcode 7 to Xcode 8 on my end.


I think you must have code signing turned off in your Jenkins build. I do in my Travis builds. However if you want to run on the device you have to sign the app. Xcode 8 is definitely different in requiring that DEVELOPMENT_TEAM is set to a known value. See https://pewpewthespells.com/blog/migrating_code_signing.html. According to that, you no longer need to specify PROVISIONING_PROFILE when using automatic code signing.

I have opened a stackoverflow question about this: http://stackoverflow.com/questions/39669661/how-to-prevent-xcode-8-from-saving-development-team-in-pbxproj to find a wider audience.

Mark Callow

unread,
Mar 6, 2017, 8:54:20 PM3/6/17
to gyp-developer, marks...@gmail.com, tjg...@tatewake.com


On Saturday, September 24, 2016 at 8:37:34 AM UTC+9, Mark Callow wrote:

I have opened a stackoverflow question about this: http://stackoverflow.com/questions/39669661/how-to-prevent-xcode-8-from-saving-development-team-in-pbxproj to find a wider audience.

For the record, a good solution was posted at the above stackoverflow link.
Reply all
Reply to author
Forward
0 new messages