Post

Replies

Boosts

Views

Activity

iOS Security Scoped Folder Bookmark
I'm trying to persist a bookmark to an external device (mass storage controller connected via camera adapter) across disconnection / reconnection, but it is failing at startAccessingSecurityScopedResource. The URL is initially retrieved using UIDocumentPickerViewController *documentProvider; documentProvider = [[UIDocumentPickerViewController alloc] initForOpeningContentTypes:[NSArray arrayWithObjects:UTTypeFolder, nil]]; documentProvider.delegate = self; documentProvider.modalPresentationStyle = UIModalPresentationOverFullScreen; [self presentViewController:documentProvider animated:YES completion:nil]; and then persisted to a bookmark using DeviceBookmark = [url bookmarkDataWithOptions:NSURLBookmarkCreationMinimalBookmark includingResourceValuesForKeys:nil relativeToURL:nil error:nil] When accessing the resource I use NSURL *url = [NSURL URLByResolvingBookmarkData:DeviceBookmark options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:&isStale error:&error] to retrieve the new URL. If I don't remove the MSC then the retrieved URL remains the same and functions as expected. If I remove and reconnect the MSC then the URL changes, I get true for isStale and nil for error but startAccessingSecurityScopedResource fails. I've been banging my head against this for about a day now, but can't see what the issue can be. I've tried adding some related permissions to the entitlements, but this seems to be macOS related as far as I can tell. What am I missing?!
4
0
71
2d