I am developing iOS app (with Xamarin). I try to handle pdf files with my app and access theirs content. I added my app to context menu of pdf files ("Open in..."), like here https://i.stack.imgur.com/yowSw.png
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>PDF</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>com.adobe.pdf</string>
</array>
</dict>
</array>
When I click "Open in MY APP", my app opens and I try to access byte array content of file.
In SceneDelegate, I added
[Export("scene:openURLContexts:")]
public void OpenUrlContexts(UIScene scene, NSSet<UIOpenUrlContext> urlContexts)
{
var path = urlContexts.AnyObject.Path;
var fileBytes = File.ReadAllBytes(path);
}
Path looks like: file:///private/var/mobile/Containers/Shared/AppGroup/XXX/File%20Provider%20Storage/sample.pdf
Unfortunately, reading throws an exception: System.UnauthorizedAccessException: 'Access to the path "/private/var/mobile/Containers/Shared/AppGroup/XXX/File Provider Storage/sample.pdf" is denied.'
How can I access byte content of file opened in that way?