Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config different Capabilities based on environment #24

Open
vinhlk opened this issue Mar 20, 2019 · 8 comments
Open

Config different Capabilities based on environment #24

vinhlk opened this issue Mar 20, 2019 · 8 comments

Comments

@vinhlk
Copy link

vinhlk commented Mar 20, 2019

Hi is there a way to config Different Capabilities base on environment (Dev, Stagging, Production) (in my case is AppGroup) ?

Seem we should modify

plists:
    "NatriumExampleProject/Info.plist":
        CFBundleDisplayName:
            Staging: App_staging
            Production: App
    "NatriumExampleProject/App.entitlements":
        "aps-environment":
            "*":
                Debug: "development"
                Release: "production"

But what is the config for other capabilities? (AppGroup for example)?

@basvankuijck
Copy link
Member

You could use xcconfig variables in your entitlements file, for instance:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>com.apple.security.application-groups</key>
	<array>
		<string>$(APPGROUP1)</string>
		<string>$(APPGROUP2)</string>
	</array>
</dict>
</plist>

and then use this in .natrium.yml

xcconfig:
    APPGROUP1: "com.app.group1"
    APPGROUP2: "com.app.group2"

or create different entitlement files per configuration / environment and use the files setting in your .natrium.yml file

@vinhlk
Copy link
Author

vinhlk commented Mar 20, 2019

Thanks. How about extension entitlement? (PushNotificationExtension.entitlements) (in extension we also have entitlement). can we still use xcconfig?

@basvankuijck
Copy link
Member

@vinhlk: Yes, works the same way

@vinhlk
Copy link
Author

vinhlk commented Apr 4, 2019

I have tried NotificationExtension. the 1st option xcconfig does not seem to work. (Also created scheme for pushnotification-dev, pushnotification-staging...)

@basvankuijck
Copy link
Member

basvankuijck commented Apr 5, 2019

Another approach would be to use the files setting in your .natrium.yml file:

files:
    Path/To/NotificationExtensions.entitlements:
        Staging: Path/To/NotificationExtensions-staging.entitlements:
        Production: Path/To/NotificationExtensions-production.entitlements:

The only thing you need to do is create 2 seperate entitlements files for each environment

@vinhlk
Copy link
Author

vinhlk commented Apr 6, 2019

I still have problem config natrium with notification extension. I have set value for notification extension 's info.plist (with bundle ID and Display name ) for different environment and successfully generate Bundle Identifier for notification extension. But in my build setting (for notification extension target, the Product Bundle Identifier value never change. Do you have a sample natrium that use notification extension for different environment?

@vinhlk
Copy link
Author

vinhlk commented Apr 7, 2019

Hi @basvankuijck I made it work by using multiple file for notification extension entitlement. i have tried xcconfig and "RichPushNotificationExtension/NotificationExtension.entitlements": "com.apple.security.application-groups": "#{AppGroup}" but no luck. Hope there is an update support these config instead of multiple file

@basvankuijck
Copy link
Member

basvankuijck commented Apr 8, 2019

The "problem" is that it only changes the xcconfig for the target that initiates the build (e.g. NatriumExampleProject) and not any target dependencies (e.g. RichPushNotificationExtension).

I'll put it on the todo list so you can change the settings of any dependency target

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants