XCTestCase in UITesting: containerURLForSecurityApplicationGroupIdentifier returns nil

Hi,

I am trying to write some UI Tests in which I want to check something in the shared App Groups container. But when I run


[[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:@"group.com.zaal.cjournalTestGroup"]


it returns nil.

The target app works perfectly fine, and the "containerURLForSecurityApplicationGroupIdentifier" works there. Do I need to setup something in the UI Testing bundle to get it to work as well? I don't see any place in the project configuration where the UI Testing bundle can get permissions for a shared App Group container. I was assuming it would pick up the settings from the target app and just work.

I'm having the same problem (Xcode 7 beta 6).


The nil return happens when running the test suite on XC Server via a Bot—but it works just fine if I run the tests manually on my local machine.

Might it be because to get access to the container the app needs to be code-signed, which doesn't necessarily have to be the case when testing on Simulators? We have the exact same problem when we change provisioning profiles and forget to update them & build for simulator. Make sure the app is codesigned.

:Good tip—I think you may be right.


Unfortunately, I realized there is also another problem whereby Xcode seems to wreck the .xctest bundle after code-signing it, thereby breaking the signature. As such I can't even deploy the test suite on a hardware device. This might be the same root cause as the -[NSFileManager containerURLForSecurityApplicationGroupIdentifier:] failure.


I posted about this on Friday: http://lists.apple.com/archives/xcode-users/2015/Sep/msg00060.html


Is this a bug in Xcode 7 beta 6?


b

XCTestCase in UITesting: containerURLForSecurityApplicationGroupIdentifier returns nil
 
 
Q