Hi,
is there anyone out there who successfully used the new <bookmark> data introduced with fcpxml 1.2?
I´m trying to sandbox my app. This app needs access to the video files (<asset>) but sandbox just denies file-read-data. So this is what I´ve done so far:
1.) Enable Entitlements & enable App Sandboxing
2.) The app.entitlements file has following entitlements set to true:
3.) Customize the decoding function that the fcpxml documentation refers to (see
Security Transforms Basics). Now the Base64 decoder function looks like this:
NSData *base64StringDecode(NSString *string){
const char *sourceCString = [string UTF8String];
SecTransformRef decoder;
CFDataRef sourceData = NULL, decodedData = NULL;
CFErrorRef error = NULL;
// Create a CFData object for the source C string.
sourceData = CFDataCreate(kCFAllocatorDefault,(const unsigned char *)sourceCString,(strlen(sourceCString) + 1));
// Create the transform objects
decoder = SecDecodeTransformCreate(kSecBase64Encoding, &error);
if (error) { CFShow(error); exit(-1); }
// Tell the decode transform to get its input from the encodedData object.
SecTransformSetAttribute(decoder, kSecTransformInputAttributeName,sourceData, &error);
if (error) { CFShow(error); exit(-1); }
// Execute the decode transform.
decodedData = SecTransformExecute(decoder, &error);
if (error) { CFShow(error); exit(-1); }
CFRelease(decoder);
return (NSData *)decodedData;
}
4.) So here is where it outputs errors:
// pass the <bookmark> NSString to the decoder function
NSData *decodedBookmark = base64StringDecode(bookmarkString);
// generate a security-soped URL
NSURL *sourceURL = [NSURL URLByResolvingBookmarkData:decodedBookmark options:NSURLBookmarkResolutionWithSecurityScope relativeToURL:clipURL bookmarkDataIsStale:nil error:&error];
But the sourceURL stays nil. If I log decodedBookmark, I get a lot of hexadeciml data. If I NSLog the &error I get this:
So here is the big question: what am I doing wrong? Did I missed something? Is the base64 decoding bad? Why is URLByResolvingBookmarkData: not generating a NSURL?
I´m frustrated and need some help.
Thomas