21

I had been using the Automatically Manage Signing option for some time. Yet when I do so in the recent Xcode 8.0 version it forces me to use the developer Code Signing Identity even for release and distribution in the Build Settings, what is quite strange per se. And when I submit the relative binary I get the dreaded Missing Push Notification Entitlement email from Apple. To make up for it I disabled the automatic option and returned manually specifying the profiles, and that allowed me to keep the distribution profile in the distribution Build Setting and save me the warning email from Apple.

Why the automatic management works this way and what to do to adjust its behaviour?

Mo Abdul-Hameed
  • 6,030
  • 2
  • 23
  • 36
Fabrizio Bartolomucci
  • 4,948
  • 8
  • 43
  • 75

1 Answers1

58

With the release of Xcode 8, Apple introduced a new way of managing the signing configuration. Now you have two options Manual and Automatic.

This new Automatic Signing doesn't work the same way as it did in previous Xcode versions. Before, when you set Automatic provisioning profiles, Xcode was using the first provisioning profile and certificate in your computer that matches the entitlements and bundle identifier that you were trying to use.

In Xcode 8, Automatic Signing is going to manage profiles, entitlements and certificates for you, but only for Development. If you select automatic, you are forced to use Development signing and Xcode-created provisioning profiles.

On the WWDC 2016 (Session 401 - What's new in Xcode app signing) they explain this new signing method and describe some 'Best Practices'. When you are building for distribution and using Automatic Signing or Manual you should Archive for Development and then export (from the organizer or the command line tools xcodebuild -exportArchive) as Distribution. The organizer will re-sign your app for Distribution even if it was archived for Development.

The other issue that you describe, "Missing Push Notification Entitlement" is because Xcode 8 has changed the way it applies entitlements. With previous versions of Xcode, you didn't have to explicitly add the APS Environment entitlement, it was enough if your provisioning profile had that entitlement. Make sure that you have the Push Notification capability enabled in the Capabilities tab, and check that there are no errors there.

(Edit: this new behavior is intentional and described in the Xcode 8 release notes: https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html#//apple_ref/doc/uid/TP40001051-CH1-DontLinkElementID_44)

Xcode 8 does not automatically copy the aps-environment entitlement from provisioning profiles at build time. This behavior is intentional. To use this entitlement, either enable Push Notifications in the project editor’s Capabilities pane, or manually add the entitlement to your entitlements file. (28076333)

junjie
  • 7,946
  • 2
  • 26
  • 26
pablobart
  • 2,641
  • 1
  • 24
  • 22
  • Yes, in fact the notification capability was strangely red. I pushed the button and it got in too. Strange behaviour. I think I shall have to submit the binary as this one goes without notifications. At any rate Apple did not reject my binary. – Fabrizio Bartolomucci Sep 17 '16 at 12:05
  • 1
    @pablobart, is it normal that entitlement has value "APS Entitlement -> development" after pressing fix issue button in Capabilities? I think about distribution value. – gaussblurinc Sep 23 '16 at 09:48
  • 1
    Here's the WWDC 2016 Session 401 video: https://developer.apple.com/videos/play/wwdc2016/401/ – Nick N Jan 26 '17 at 16:49
  • 4
    Here's a really good detailed article to assist with code signing and XCode 8: https://pewpewthespells.com/blog/migrating_code_signing.html – Nick N Feb 02 '17 at 15:46
  • "Xcode-created provisioning profiles." is this mean xcode will auto create in developer.apple.com? because i did read some, when it did say it will create with generic 'XC' – Jai Gtz Jun 06 '18 at 04:15