NSURLTagNamesKey returns only first tag on sandboxed apps

I need to read the tags assigned to a file, if I use the code shown below on cli tools projects everything works fine, the identical code executed from sandboxed apps returns only the first element

NSDictionary<NSURLResourceKey, id>* dict = [[NSURL fileURLWithPath:@"absolute_file_path"] resourceValuesForKeys:@[NSURLTagNamesKey] error:nil];
        NSLog(@"Result %@", dict);

The same with swift, running the code from playground the result is correct, running it from swift sandboxed app only the first element is returned

Is this a bug?

Well, that’s weird. Does your sandbox have access to this file? That is, if you call +dataWithContentsOfURL:options:error: on the URL, does that work?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

NSURLTagNamesKey returns only first tag on sandboxed apps
 
 
Q