Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding aps-environment entitlement to UITest Target in Xcode

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

like image 300
Charlie Seligman Avatar asked Aug 24 '18 14:08

Charlie Seligman


1 Answers

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.

like image 141
Charlie Seligman Avatar answered Sep 30 '22 04:09

Charlie Seligman