Questions tagged [uidocument]

UIDocument represents a user-editable document in an iOS application. It is an abstract base class in the UIKit framework. When it is used, its subclass takes the role of the model of a model-view-controller application. Because it implements the NSFilePresenter protocol, it significantly simplifies writing a document-based iOS application. Its Mac OS counterpart is NSDocument.

UIDocument represents a user-editable document in an iOS () application. It is an abstract base class in the UIKit () framework. When it is used, its subclass takes the role of the model of a model-view-controller application. Because it implements the NSFilePresenter protocol, it significantly simplifies writing a document-based iOS application. Its Mac OS () counterpart is NSDocument ().

To learn more, see the Document-Based App Programming Guide for iOS.

268 questions
0
votes
1 answer

NSFileVersion's unresolvedConflictVersionsOfItemAtURL: behaviour

Does anybody know the case when [NSFileVersion unresolvedConflictVersionsOfItemAtURL:] returns more then 1 versions?
esmirnov
  • 376
  • 2
  • 13
0
votes
1 answer

Can UIWebView be used to view and edit XML documents in an iOS app

If my app creates and edits outline-style XML documents, can the documents be rendered in a UIWebView and edited, while rendered, in that same view?
0
votes
1 answer

Managing files in iOS5

I want to handle files in my iOS App. My app should create a file with a custom suffix (e.g. file.mysuff) and save it to the device so I'll be able to copy it using iTunes File Sharing. Then I want to be able to attach that file to a new mail. When…
Julian F. Weinert
  • 7,474
  • 7
  • 59
  • 107
0
votes
1 answer

UIDocumentBrowserViewController doesn't call localizedName or honor shouldShowFileExtensions

I am using Xcode 14.2 on macOS Ventura 13.2, working on an iOS app initially created from Xcode's template via New Project > iOS > Document App. I am using Objective-C, not Swift. I am testing in the simulator's "iPad Pro (12.9 in) 6th Generation -…
0
votes
2 answers

What is the best strategy for saving a "Most Recently Used" document list on iOS?

Is there a foolproof way of saving the URL of a UIDocument so an application can resume editing the document on next launch? I have tried various ways of saving the URL, but sometimes the document URL will slightly differ from what is expected. For…
0
votes
0 answers

Proper way to check if URL points to directory or file (uncluding FileWrapper)?

I am looking for a proper way to definitively check if an URL points to a file or a directory. Files should include filewrapped data like UIDocument using a FileWrapper to wrap its underlying structure. I am aware of the fact that URLResourceValues…
Wizard
  • 295
  • 1
  • 4
  • 15
0
votes
2 answers

UIDocument saveToURL deletes original file

I'm trying to use -[UIDocument saveToURL:(NSURL *)url forSaveOperation:(UIDocumentSaveOperation)saveOperation completionHandler:(void (^ __nullable)(BOOL success))completionHandler] to save a duplicate at a new URL, however the original file…
catlan
  • 25,100
  • 8
  • 67
  • 78
0
votes
0 answers

NSURL URLByAppendingPathExtension Crash

The following code ran fine on iOS 14.0, but now on iOS 15.0, causes a crash. var noteFile: NoteFile! func saveToNoteFile(completion: ((Bool) -> Void)?) { let mutableAttrs = NSMutableAttributedString(attributedString:…
0
votes
2 answers

UIDocumentPickerViewController when initialized in a framework shows files as grayed out

I want to initialize an UIDocumentPickerViewController from a framework. But, the files (.pdf) are shown as grayed out in the document picker when using below code in framework. The code works fine when UIDocumentPickerViewController is initialized…
Dhanesh KM
  • 449
  • 2
  • 7
  • 18
0
votes
1 answer

Saving UIDocument fails with permissions error - `NSCocoaErrorDomain` code `513`

I am trying to build and iOS app with similar behaviour to Pages / Numbers / Keynote. Each of these apps is a Document Based App, where the user is first presented with a UIDocumentBrowserViewController where the user choses a document to open in…
lukestringer90
  • 492
  • 7
  • 16
0
votes
1 answer

Getting the default document editor toolbar in Mac Catalyst

I’ve just started porting my iPad app to the Mac using Catalyst. It’s a document editor and uses UIDocument. I’m trying to get the default toolbar behaviour for a document editor on macOS where there’s a dropdown to quickly name, tag, and move the…
Luke Rogers
  • 2,369
  • 21
  • 28
0
votes
1 answer

Syncing plist NSdata with iCloud using UIDocument and Swift

I've built an iOS app (TimeFinder) that uses plists to store user data, but I'm struggling to understand how I can support synchronizing users' data using iCloud. I imagined that syncing plist data in this manner would be a reasonably common task,…
lukemmtt
  • 476
  • 6
  • 15
0
votes
2 answers

Which thread to use for performAsynchronousFileAccessUsingBlock when reading UIDocument incrementally

I read a UIDocument incrementally and use its performAsynchronousFileAccessUsingBlock to facilitate this. Since I open the document on the main thread, I take care to also call this method on the main thread, but is that even necessary. So my…
skaak
  • 2,988
  • 1
  • 8
  • 16
0
votes
1 answer

Where is log message "document saving on resign active finished" coming from?

In my iOS SwiftUI app, I have a navigation view that lists links to several open Objective-C UIDocuments. While debugging my SwiftUI app in XCode, When I switch to another app, I get a log message in the console about "[UIDocumentLog] document…
0
votes
0 answers

Realm file as UIDocument

I've been trying to use a Realm file as a document in a Document-based iOS app. The goal is to select the Realm file from the file picker so the user can switch between Realm databases, or send a database that they've worked with to another user.…
Dwillmore
  • 65
  • 1
  • 7