coordinateAccessWithIntents & stopAccessingSecurityScopedResource

237 Views Asked by At

I'm calling coordinateAccessWithIntents after startAccessingSecurityScopedResource. In the byAccessor block, should I call stopAccessingSecurityScopedResource on the original URL or the potentially updated one?

For example...

NSFileAccessIntent *readingIntent = [NSFileAccessIntent readingIntentWithURL:myURL options:0];
[fileCoordinator coordinateAccessWithIntents:@[readingIntent] queue:queue byAccessor:^(NSError * _Nullable error) {

    // stop the original url?
    [myURL stopAccessingSecurityScopedResource];

    // or the potentially updated url?
    [readingIntent.URL stopAccessingSecurityScopedResource];
}];

On which URL should I be calling stopAccessingSecurityScopedResource?

0

There are 0 best solutions below