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
25
votes
3 answers

UIDocument not saving to file despite indicating success

I'm trying to open, modify, and save a file in iCloud Drive using UIDocument. When I call save(to:for:completionHandler:) with the file location and using .forOverwriting for the UIDocumentSaveOperation, it completes with a status of success = true.…
Matt
  • 2,576
  • 6
  • 34
  • 52
21
votes
5 answers

Swift write/save/move a document file to iCloud drive

I've been trying for over two days to write a file to iCloud drive. I have tried writing a simple text file directly, locally then moving it, using UIDocumentMenuViewController, etc. I'm not getting any errors with my code and stepping through…
Paul C
  • 261
  • 1
  • 2
  • 8
20
votes
4 answers

How to open the Document files e.g(.pdf,.doc,.docx) in ios mobile when a button action using swift3.0?

I need to open UIDocumentPickerViewController and It should allow user to select all type of files. ie.(.pdf,.doc)files I used UIDocumentPickerViewController method. my Code: UIDocumentPickerDelegate, UIDocumentMenuDelegate in my class declaration…
mouni
  • 327
  • 1
  • 3
  • 15
16
votes
0 answers

Thumbnail Metadata Disappeared When Importing File with Copy to App

I have been using the URL Resources to embed the thumbnail metadata into my custom document-based file. When I export my custom document file, the thumbnail shows up nicely when glanced in iOS Files app. override func fileAttributesToWrite(to url:…
HuaTham
  • 7,486
  • 5
  • 31
  • 50
15
votes
2 answers

iCloud Documents not visible

I am trying to use iCloud Documents to store XML files from my iOS App. Everything seems to be working fine (I can write and read files without errors) except my App's files do not show up in iCloud Documents neither in icloud.com nor in…
Nostradamus
  • 668
  • 6
  • 18
13
votes
1 answer

Export UIDocument with custom file package UTI

I'm trying to export my UIDocument subclass with a UIDocumentPickerViewController. The subclass writes data to a FileWrapper and its UTI conforms to com.apple.package. But the presented document picker shows "Documents in iCloud Drive are not…
Benjamin Cheah
  • 1,401
  • 17
  • 23
13
votes
2 answers

Add "Edit in Excel" or "Edit photo" extension

I checked the latest Dropbox and Excel for iOS. In Dropbox we get an edit button. On click it opens Excel's extension where you can edit the file. After save, changes are reflected in the Dropbox file too. I want to add such a button. Also I'd like…
Durgaprasad
  • 1,910
  • 2
  • 25
  • 44
12
votes
2 answers

Save iOS 8 Documents to iCloud Drive

I want to have my app save the documents it creates to iCloud Drive, but I am having a hard time following along with what Apple has written. Here is what I have so far, but I'm not for sure where to go from here. UPDATE2 I have the following in my…
user717452
  • 33
  • 14
  • 73
  • 149
12
votes
3 answers

Why does iCloud sometimes stops working?

I sometimes have a problem with opening UIDocuments which are stored on iCloud. I call the following code at the very beginning of my app after checking if iCloud is available and getting the results of the NSMetaDataQuery. This works in 98% of all…
n.evermind
  • 11,944
  • 19
  • 78
  • 122
11
votes
2 answers

UIDocument Creation on iOS 11: reader is not permitted to access the URL

Since iOS 11 I have encountered the following error every time I am creating a new document using UIDocument API: [ERROR] Could not get attribute values for item…
HuaTham
  • 7,486
  • 5
  • 31
  • 50
10
votes
0 answers

Xcode 9.2 UIDocumentBrowserViewController : Failed to create a url from bookmarkableString

Update: Xcode 9.3 has fixed it. When creating UIDocument File in UIDocumentBrowserViewController [default] [ERROR] Could not resolve bookmark. Error: Error Domain=NSFileProviderInternalErrorDomain Code=1 "The reader is not permitted to access the…
hstdt
  • 5,652
  • 2
  • 34
  • 34
10
votes
2 answers

UIDocument & NSFileWrapper - large files taking a long time to save, despite incremental changes

I have a UIDocument based app that uses NSFileWrappers to store data. The 'master' file wrapper contains many additional directory file wrappers, each of which represents a different page of the document. When saving a large document for which only…
Stuart
  • 36,683
  • 19
  • 101
  • 139
9
votes
0 answers

UIDocument "Save As" Functionality

I have a UIDocument named "Old". I've made some changes to it and would like to re-save it under the name "New". The contents of "Old" should not change. Here is my failed attempt: First, copy the yet unsaved "Old" document to "New" file location.…
rizzes
  • 1,532
  • 20
  • 33
9
votes
1 answer

Is UIDocument a suitable strategy for large documents with metadata?

I'm looking into using UIDocument en NSFileWrapper to store 'projects' that contain quite a few large video files and some small text files. There are a few problems that I run into, and I'm starting to wonder if UIDocument is still the right…
Rengers
  • 14,911
  • 1
  • 36
  • 54
9
votes
2 answers

iOS - EncodeWithCoder - Encode Nil

I have an object that has a property that might be nil. How should I implement this in encodeWithCoder (and decodeWithCoder)? - (void)encodeWithCoder:(NSCoder *)aCoder { [aCoder encodeObject:_duration forKey:kDuration]; //_duration could be…
rizzes
  • 1,532
  • 20
  • 33
1
2 3
17 18