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
6
votes
0 answers

iOS - How to check if UIDocument is open elsewhere on iCloud?

Is there a way to check if a UIDocument (that is being synced with iCloud) has been opened elsewhere using iCloud--other than waiting for a conflict to happen?
Anton
  • 3,998
  • 25
  • 40
5
votes
1 answer

iOS5.1: synchronising tasks (wait for a completion)

I have a basic problem synchronizing openWithCompletionHandler: (UIManagedDocument) with the main activities. Situation: I have a singleton class managing a shared UIManagedDocument. This class provides one method which should deliver the document…
tschloss
  • 367
  • 3
  • 11
5
votes
3 answers

Where to store a preview of a UIDocument?

I'm working on UIDocument application and I'd like to show the user a preview of the document before he opens it. I can render that preview into an image when the document get's closed. But where should I save that image? In an other file? or is…
V1ru8
  • 6,139
  • 4
  • 30
  • 46
5
votes
2 answers

Renaming a UIDocument in iCloud

I'm struggling to figure out how to rename an instance of a UIDocument subclass in an iCloud folder. I've tried saving the document with the new URL… func renameDocument(to name: String) { let targetURL =…
Ashley Mills
  • 50,474
  • 16
  • 129
  • 160
5
votes
5 answers

Having Trouble Getting the UIDocumentBrowserController to open docs in a Document based app

I've been working on a new Document-based app, and was super glad about the new UIDocumentBrowserController...trying to roll my own solution for the document browser UI was tricky! I'm having some trouble getting the browser to open documents after…
5
votes
1 answer

UIDocument Recover Unsaved Changes On App Crash/Force Quit

From what I understand, the UIDocument class can track unsaved changes to a file and even locks the file so it cannot be checked out by more than one person. But what happens if the user force quits the app without saving or the app crashes? How…
rolling_codes
  • 15,174
  • 22
  • 76
  • 112
5
votes
1 answer

startAccessingSecurityScopedResource() return always false

When I try to import a file to my server from iCloud Drive or Dropbox, startAccessingSecurityScopedResource() return false only device but return true when I testing in simulator (Xcode 8, Swift 2.3, minimum target 8.0). This is my code: { …
Zept
  • 1,158
  • 1
  • 10
  • 14
5
votes
2 answers

UIDocumentInteractionController share via Instagram (and ONLY Instagram)

When I use UIDocumentInteractionController to allow users to share via Instagram, it does work, it brings up the option for "open with" and "Instagram" as one of the options... the problem is that it also displays many other apps like "Facebook" and…
Albert Renshaw
  • 17,282
  • 18
  • 107
  • 195
5
votes
1 answer

iOS 6 sharing like Messages, not like Photos (UIActivityViewController and UIDocumentInteractionController)

In iOS 6, tapping the action button in the Photos app presents the standard UIActivityViewController: Doing the same from Messages presents a different set of options. This looks to me like it's using the UIDocumentInteractionController api to pull…
5
votes
0 answers

How to add button to UIDocumentInteractionController preview

I'm using UIDocumentInteractionController for files preview: interactionController = UIDocumentInteractionController.FromUrl(url); interactionController.Delegate = new UIDocumentInteractionControllerDelegateClass(this); …
4
votes
2 answers

Is IOS 5 UIDocument subclass backwards compatible?

To support iCloud, we're encouraged to use a UIDocument subclass. If I define a new subclass, set the project target version to 3.0, and test using for iOS 5 before using my new subclass, will the code work on iOS 4 or does linking in a subclass…
wordy
  • 539
  • 5
  • 15
4
votes
2 answers

Merging UIDocument changes for iCloud conflicts

I've spent some days now trying to find, or figure out for myself, how to programmatically merge UIDocument changes when the notification UIDocumentStateChangedNotification fires and the document's state has UIDocumentStateInConflict set. All the…
Seoras
  • 1,286
  • 13
  • 21
4
votes
3 answers

QLThumbnailProvider extension does not appear to be called

I'm developing a QLThumbnailProvider extension to display thumbnails for my document type. My extension does not appear to be being called - my thumbnails are not appearing and I'm not seeing the logging I've added appearing in any log files. I…
Mark Alldritt
  • 597
  • 1
  • 4
  • 9
4
votes
0 answers

File rename failing with NSCocoaErrorDomain Code=513 on device

I'm trying to rename a file (a FileWrapper containing a UIDocument subclass) as follows: coordinationQueue.async { var error: NSError? = nil let fileCoordinator = NSFileCoordinator(filePresenter: self) …
Ashley Mills
  • 50,474
  • 16
  • 129
  • 160
4
votes
1 answer

iOS App using iCloud storage is adding .icloud file extension to my documents

In my iOS (swift 3.0) mobile application, the device creating a document to store in iCloud is able to load and manipulate the file again. Once iCloud transfers the file(s) to another device, they are no longer able to open and have a "." prepended…
Bryan M
  • 101
  • 6
1 2
3
17 18