Provisioning profile "iOS Team Provisioning Profile: abc.XYZUITests" doesn't include the com.apple.security.application-groups entitlement.

This is in Xcode Version 11.5 (11E608c).



In XCTestCase following call was returning nil when UITests was run on the

device:



[NSFileManager.defaultManager containerURLForSecurityApplicationGroupIdentifier:@"group.abc"]



App Group group.abc is added to the main target XYZ. There is no option to add

app group to the XYZUITests target.



I checked XYZ's Provisioning Profile "Xcode Managed Profile" and it shows:



----------------------

App Groups: 1 included

Includes group.abc.

----------------------



and also:



-----------------------------------------

Entitlements: 5 included

Includes application-identifier,

...,

and com.apple.security.application-groups.

-----------------------------------------



I checked XYZUITests's Provisioning Profile "Xcode Managed Profile" and

there was no "App Groups" and "Entitlements" did not include

com.apple.security.application-groups.



So, I added following to the "Build Settings" of XYZUITests:



In the Code Signing Entitlements field (both Debug/Any SDK and Release/Any SDK)

I added XYZUITests/XYZUITests.entitlements.



Please note that I had copied XYZ/XYZ.entitlements as

XYZUITests/XYZUITests.entitlements to ensure that XYZUITests also had the

exact same entitlements as XYZ (the main app).



But under "Signing & Capabilities" Tab when Provisioning Profile is created

for XYZUITests, it throws this error:



Provisioning profile "iOS Team Provisioning Profile: abc.XYZUITests" doesn't include the com.apple.security.application-groups entitlement.



Short question is: how do I make the following work in UITests:



[NSFileManager.defaultManager containerURLForSecurityApplicationGroupIdentifier:@"group.abc"]



Is it possible to achieve that within Xcode or with the free developer account?



Thanks.

Provisioning profile "iOS Team Provisioning Profile: abc.XYZUITests" doesn't include the com.apple.security.application-groups entitlement.
 
 
Q