Xcodegen: Capabilities - Push Notifications

Created on 21 Mar 2019  路  2Comments  路  Source: yonaskolb/XcodeGen

Hello!

I would like to know how to add push notification ON configuration in xcodegen

image

And where to find more information about how to configure this part.

Thank you beforehand for your support!

Most helpful comment

Hi @VictorUrielP

To answer questions like this, make the changes in a project that is tracked in git and then look at the diff. In this case there are actually quite a couple of changes.

Entitlement file
There is an entry added to your entitlement file. You can check the box in Xcode to edit your linked one or created a new one.
It will add the following content to your entitlements file.

<key>aps-environment</key>
<string>development</string>

To link an existing entitlements file you need to set the CODE_SIGN_ENTITLEMENTS build setting:

targets:
  App:
    settings:
      CODE_SIGN_ENTITLEMENTS: path/to/Entitlements.entitlements

If you are instead generating an entitlements file you can define this in your target

targets:
  App:
    entitlements:
      path: path/MyEntitlements.entitlements
      properties:
        aps-environment: development

Target attributes
It also seems Xcode adds the following attributes to a target.

SystemCapabilities = {
  com.apple.Push = {
    enabled = 1;
  };
};

I'm not sure if this is required or not. If so you can set these like this:

targets:
  App:
    attributes:
      SystemCapabilities:
        com.apple.Push:
          enabled: 1

I hope that helps you. Let me know if you have any more questions.

All 2 comments

Hi @VictorUrielP

To answer questions like this, make the changes in a project that is tracked in git and then look at the diff. In this case there are actually quite a couple of changes.

Entitlement file
There is an entry added to your entitlement file. You can check the box in Xcode to edit your linked one or created a new one.
It will add the following content to your entitlements file.

<key>aps-environment</key>
<string>development</string>

To link an existing entitlements file you need to set the CODE_SIGN_ENTITLEMENTS build setting:

targets:
  App:
    settings:
      CODE_SIGN_ENTITLEMENTS: path/to/Entitlements.entitlements

If you are instead generating an entitlements file you can define this in your target

targets:
  App:
    entitlements:
      path: path/MyEntitlements.entitlements
      properties:
        aps-environment: development

Target attributes
It also seems Xcode adds the following attributes to a target.

SystemCapabilities = {
  com.apple.Push = {
    enabled = 1;
  };
};

I'm not sure if this is required or not. If so you can set these like this:

targets:
  App:
    attributes:
      SystemCapabilities:
        com.apple.Push:
          enabled: 1

I hope that helps you. Let me know if you have any more questions.

Thanks you for your answer. It took us a while to get this working. We figured out that we had to add other configuration in target Build Settings:

DEBUG_INFORMATION_FORMAT: dwarf-with-dsym

This line was overwritten by xcodegen to default property. Thanks again for your help. I will close this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheInkedEngineer picture TheInkedEngineer  路  4Comments

vlozko picture vlozko  路  4Comments

ImLaufderZeit picture ImLaufderZeit  路  5Comments

AlexisQapa picture AlexisQapa  路  3Comments

pvinis picture pvinis  路  6Comments