Question

Blimey, this Sandboxing makes me despair: I have an app that's been released on Apple's store (so, in theory, it's gone through review...), it's a slide show player - nothing too fancy - the user can drag and drop images onto an NSTableView or select through NSOpenPanel. Anyway, I thought I'd use it myself so I recompiled a copy onto my laptop and all of a sudden I'm not allowed security bookmarking:

QuickSlide(1412) deny mach-lookup com.apple.scopedbookmarksagent.xpc

The above appears whenever I drag and drop images or select them through the NSOpenPanel.

I have the following entitlements:

enter image description here

The code I'm using to generate the bookmarks is:

-(NSData*)genSec:(NSURL*)aURL
{
    NSError *error;
    NSData  *secData = [aURL bookmarkDataWithOptions:(NSURLBookmarkCreationWithSecurityScope | NSURLBookmarkCreationSecurityScopeAllowOnlyReadAccess | NSURLBookmarkCreationPreferFileIDResolution)
                     includingResourceValuesForKeys:nil relativeToURL:nil error:&error];
    if (error) {
        [self setReport: [NSString stringWithFormat:@"Can't access %@ due to SandBoxing",aURL]];
        return nil;
    }
    return secData;
}

Sure enough, the report method is also fired along with the Console logging.

It's never done this before in the months I did of development. I've also tried it on my dev Mac Pro crate, tried code-signing with different or no signing, and even downloaded it from the App Store (tried twice with 2 different accounts); all with the same result. I've also used the very handy Receigen app to check the entitlements in the compiled bundle. I'm running 10.7.5. The only thing that stops it from throwing errors is if I un-check the 'enable sandboxing' option in Xcode and compile.

Argghhh. Can someone point out the blindingly obvious mistake that somehow has slipped through 2 beta-testers, me, and an App Store reviewer...?!!!!

It has to be something obvious doesn't it?

UPDATE: I got a colleague to download a fresh copy to his laptop and there was no problem with sandboxing. I'd still appreciate it if anyone can shed some light on what's happening to my installs...

Todd.

Was it helpful?

Solution

Sure enough it seems from your entitlements that it is something obivous. You need to add this one as well:

com.apple.security.files.bookmarks.app-scope

I don't know why it was working before and now isn't, but I'm positive you need to declare this entitlement for security scoped bookmarks to work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top