Adding aps-environment entitlement to UITest Target in Xcode
Asked Answered
L

1

6

I am testing an app that uses Push notifications. Within the main app target, the 'Push Notifications' (inside the Capabilities tab) is set to on.

I created a UITest target for UI Automation Testing. UITest targets do not contain a 'Capabilities' tab so I am unable to set this target to use push notifications. When I try and Automatically manage signing, I get the following error message:

"Automatic signing can't add the aps-environment entitlement to your provisioning profile. Switch to manual signing and resolve the issue by downloading a matching provisioning profile form the developer website."

The trouble is the Xcode managed provisioning profiles do not seem to appear in the Developer Portal anymore.

Does anyone know a way round this? Is there perhaps a build setting within the UITest Target that I can set to add the aps-environment entitlement (instead of using the Capabilities tab).

PS - looking online all accepted answers for this error are to switch on Push notifications in the 'Capabilities' tab (something we don't have in the UITest target): e.g. Error when running ionic cordova run ios - seems to be related to push notification

Lunnete answered 24/8, 2018 at 14:5 Comment(0)
L
12

Fixed this by removing the need for entitlements from the XCUITest Target. Here are the details:

Selected the UITest target > Went to the UITest 'Build Settings' tab > Searched for 'Code Signing Entitlements' > Removed all entitlement values here (since only removing them from the XCUITest target not the app itself)

This fixed the error and allowed it to work.

Lunnete answered 29/8, 2018 at 14:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.