I have registered my file type and when I am trying to read the passed file, I always get an access denied exception. This is my current code:
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
{
var text = File.ReadAllText(url.Path); <- Exception here
// todo: handle text
return true;
}
On android I got it working with the ContentResolver:
using (var inputStream = ContentResolver.OpenInputStream(Intent.Data))
{
using (StreamReader reader = new StreamReader(inputStream))
{
string text = reader.ReadToEnd();
Clipboard.SetTextAsync(text);
}
}
but I did not find an equivalent to read the passed file on iOS.