In the case of multiple targets, make sure you are sharing the Core data model using a common App Groups container?All the targets should be looking at the same container? Make sure also that the targets are members of the same Core data model. If not, the different targets can't use the same model. See the identity inspector inside the core data attributes area and make sure your targets are ticked?
Store security-scoped bookmarks from a URL using:
(NSData *) bookmarkDataWithOptions: (NSURLBookmarkCreationOptions) options
includingResourceValuesForKeys: (NSArray<NSURLResourceKey> *) keys
relativeToURL: (NSURL *) relativeURL
error: (NSError * _Nullable *) error;
Save NSData
that results, in core data, as Binary Data
datatype.
Resolve the bookmark using:
(instancetype) URLByResolvingBookmarkData: (NSData *)bookmarkData
options: (NSURLBookmarkResolutionOptions) options
relativeToURL: (NSURL *) relativeURL
bookmarkDataIsStale: (BOOL *) isStale
error: (NSError * _Nullable *) error;
This returns a URL.
Have a look at WWDC 15 session 234 and the accompanying sample code in relation to security-scoped bookmarks.
Hope this helps..