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
2
votes
1 answer

How to present the error message when opening UIDocument?

I have a document based iOS app, and when it first opens a document, the main view controller calls UIDocument.open. document.open { success in if success { ... set up UI ... } else { ??? } } The problem here is that if success is false, I…
Rob N
  • 15,024
  • 17
  • 92
  • 165
2
votes
1 answer

UIActivityViewController and UIDocument package

Summary: Mail appears to flatten document packages when sending them. Background: I'm using subclassed UIDocument and FileWrappers to provide a document package for storing metadata, data and a thumbnail preview for my documents. I've made the…
joshd
  • 1,626
  • 14
  • 17
2
votes
1 answer

Pick UIDocument automatically in UIDocumentBrowserVC

I am using a uidocumentbrowservc and want to pick a UIDocument programmatically. In my case it is because i want to automatically load the last used UIDocument to save the user some time on launch, as my app seldom changes documents. My naive…
A. Vage
  • 35
  • 5
2
votes
1 answer

iCloud NSDocument save warnings - caused by lastUsedDate file attribute?

I have an app that uses NSPersistentDocument (without autosaving) on OS X and UIDocument (also without autosaving) on iOS. The file representation is Binary Core Storage. This app has been working fine since iOS 7 + macOS 10.10. If I open a document…
MichaelR
  • 1,681
  • 15
  • 28
2
votes
1 answer

Getting content of file from path

I am struggling with few lines of code which is embarassing. I have read many answers but none seems to work. In my function I get a file path from picked document: func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt…
misi06
  • 259
  • 1
  • 8
  • 16
2
votes
0 answers

icloud drive is missing in UIDocumentInteractionController

Hy, iCloud Drive is absent while open any type(xls,doc,ppt) of file written on a path at document directory. iCloud services and containers have valid identifier at Targets>Capabilities>iCloud. I am using UIDocumentInteractionController to open the…
Ketan Shinde
  • 1,847
  • 4
  • 18
  • 38
2
votes
0 answers

How to deal with NSFileWrapper and concurrency?

Using NSFileWrapper and UIDocument. File writing happens in: class MyDocument: UIDocument { var wrapper: NSFileWrapper? override internal func contentsForType(typeName: String) throws -> AnyObject { // called by doc.saveToURL if wrapper…
JKaz
  • 765
  • 6
  • 18
2
votes
1 answer

How to create documents in iCloud Drive?

I have an application that creates UIDocuments on iCloud. I have used my apple account to upgrade to iCloud Drive, but I haven't been able to see those UIDocuments in my iCloud Drive folder. How can I create documents in iCloud Drive? I want the…
Aнгел
  • 1,361
  • 3
  • 17
  • 32
2
votes
0 answers

UIDocument & NSFileWrapper with many small files crashes due to low memory

I have a custom UIDocument consisting of a file package with many small files (about 3200 text files). The overall size of the document is only ~600KB, but my app crashes each time I attempt to open the document due to low memory. I tracked it down…
Mark
  • 6,647
  • 1
  • 45
  • 88
2
votes
1 answer

UIDocument loadFromContents: is not always called after document was changed on another device

I have a custom UIDocument subclass and implemented loadFromContents: and contentsForType:. To detect that the document was changed on another device, I added a delegate to loadFromContents: as suggested in the Apple documentation: -…
Mark
  • 6,647
  • 1
  • 45
  • 88
2
votes
0 answers

iCloud: Strategy to merge two versions of a file package (common ancestor)?

I have a document based app (Mac & iOS) and am trying to find a good way to automatically resolve version conflicts without bothering the user. My document is actually a file package with lots of small notes stored as text files. The most likely…
Mark
  • 6,647
  • 1
  • 45
  • 88
2
votes
0 answers

Exc Bad Access while unarchiving data from iCloud using UIDocument

Hi i am using iCloud support for my application and using UIDocument for storage. I was able to save data to iCloud and fetch the same for first time. But when i deleted and reinstalled the app on device, the seems to crash with EXC BAD ACCESS while…
vinod
  • 51
  • 5
2
votes
1 answer

iPhone:Upload image on Instagram

I have written the code to upload image on instagram which is as follows: CGRect rect = CGRectMake(20 ,20 , 200, 200); UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0); [self.view.layer…
user1954352
  • 1,577
  • 4
  • 14
  • 16
2
votes
0 answers

Is the method removeAndReturnError: not necessary?

I've just read the documentation about conflict resolution with UIDocuments in the iCloud: Resolving Document Version Conflicts In the last point of the chapter "How to Tell iOS That a Document Version Conflict Is Resolved" is written: Remove the…
Linard Arquint
  • 574
  • 3
  • 12
  • 32
2
votes
1 answer

How to determine if the local file is newer when moving local files to iCloud?

When the user enables iCloud in my app, I need to move all local files to iCloud. Here, I use setUbiquitous:itemAtURL:destinationURL:error: to move each file. The problem is, if (for any local file) the same file URL already exists on iCloud, this…
Anton
  • 3,998
  • 25
  • 40