Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I view the contents of the App Group Shared Container directory when debugging an iOS app?

Fairly self explanatory.

We can view the app's documents, library, tmp directories via Window > Devices (this has been the case forever).

But when app extensions came on the scene with iOS8, the App Group shared container came with them. How can I view its contents?

Edit: to clarify, I'm not asking how to interact with this directory in code. I'm asking about how to interact with this directory in the context of Finder.

like image 352
Alfie Hanssen Avatar asked Mar 03 '15 19:03

Alfie Hanssen


1 Answers

Get App Group Path

#define APP_GROUP_PATH [[[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:@"yourGrpupId"] path]

Following code to view Shared container data

NSLog(@"Shared container data:%@",[self listFileAtPath:APP_GROUP_PATH]);

-(NSArray *)listFileAtPath:(NSString *)path
{
    int count;

    NSArray *directoryContent = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:NULL];
    for (count = 0; count < (int)[directoryContent count]; count++)
    {
        NSLog(@"File %d: %@", (count + 1), [directoryContent objectAtIndex:count]);
    }
    return directoryContent;
}
like image 183
Sunil Targe Avatar answered Nov 02 '22 20:11

Sunil Targe