Deon
Deon

Reputation: 1

Xamarin.iOS with iOS 17 opens Word Documents in Read Only

We save documents from our app in a subfolder of the Documents folder (Environment.SpecialFolder.MyDocuments), which would be located at, for example: /var/mobile/Containers/Data/Application/8A3B2B40-100C-45EF-B9F1-6FBB01D27247/Documents/Notes/4324518a-2f04-4a67-b160-0fb7523ce0ba.docx

We use UIDocumentInteractionController to PresentOpenInMenu and allow the user to open the Word document for editing in the Word App

On iOS 16 and lower, the Word app is able to read and automatically save changes to the document directly in our app's folder path.

However, on iOS 17, using same codebase, Word app can open the document, but the document is in read-only mode, with a message that says "Save a copy to edit".

public async Task SaveAndView(string filename, string contentType, MemoryStream stream)
    {

        UIDocumentInteractionController uIDocumentInteractionController = null;
        string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
        string filePath = Path.Combine(path, filename);

        uIDocumentInteractionController = UIDocumentInteractionController.FromUrl(NSUrl.FromFilename(filePath));
        uIDocumentInteractionController.Uti = "com.microsoft.word.doc";

        UIView presentingView = UIApplication.SharedApplication.KeyWindow.RootViewController.View;
        uIDocumentInteractionController.PresentOpenInMenu(CGRect.Empty, presentingView, true);
    }

LSSupportsOpeningDocumentsInPlace is enabled

Created sample project just to Create a document and open it the results are the same.

Upvotes: 0

Views: 242

Answers (0)

Related Questions