Forum Xamarin.Forms

iphone simulator - launch external app to annotate pdf and images

Hi everyone,

I had previously written an application that allows the user to download files which are effectively images and pdf's that require annotation before sending back to the server, this was done for UWP and Android but has now been requested for iOS. In the absence of owning a Mac I have decided to use macincloud and this environments seems really good for the login and navigation for the app but I have some questions regarding working with files in external applications.

I hadn't previously looked at a cross platform way to work with files, for Android I used an intent and activity, for UWP I used Windows.System.Launcher. With iOS for now I was trying to use Launcher from Xamarin.Essentials and the following code:

await Launcher.OpenAsync(new OpenFileRequest
{
File = new ReadOnlyFile(filePath)
});

Now on the simulator at least I am being offered Reminders, Photos and More as options and on Photos it does not open it but instead wants to create an iCloud album, I would expect to be shown a list of programs from which to work with the file . I do not own an iPhone and I am not sure if I should be using a different implementation or if this is a limitation of the simulator and on a real device it would work better, I am guessing I cannot install 3rd party apps on a simulator. it may also be worth mentioning that for UWP and Android I store these files in Environment.SpecialFolder.LocalApplicationData but after reading about sandboxing within iOS I believe it is more correct to store files in Environment.SpecialFolder.MyDocuments and set LSSupportsOpeningDocumentsInPlace within info.plist.

I hope that this is sufficient detail of what has been done so far and would really appreciate some knowledge from any of you that have had to achieve similar things. If it is the case that what i have done is correct and I need to test this on a real device, can I do this by plugging an iPad into my windows machine running VS2019 and having macincloud running for buliding?

Best Answer

  • dannythomas13dannythomas13 ✭✭
    Accepted Answer

    I believe I have now solved this one by adding LSSupportsOpeningDocumentsInPlace to the info.plist, thanks for all the responses

Answers

Sign In or Register to comment.