When we try to run our code that uses the containerURLForSecurityApplicationGroupIdentifier function, the returned value is null if the program was run with root privileges. (when we run the code like a normal user, it is works as expected)
The following code was run:
NSFileManager* fileManager = [NSFileManager defaultManager];
if(!fileManager) {
return “”;
}
NSURL* containerURL = [fileManager
containerURLForSecurityApplicationGroupIdentifier:[NSString stringWithUTF8String:group_name]];
if(!containerURL) {
return “”;
}
-> we will receive the right containerURL:
/Users/{user}/Library/Group Containers/{group_name}
If the same code will be run with root/admin privileges the containerURL will be NULL.
With an older version of MacOS the output result was the following:
normal user: /Users/{user}/Library/Group Containers/{group_name}
root user : /private/var/root/Library/Group Containers/{group_name}