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
1
vote
1 answer

DocumentPicker got NULL for file

I tried to get Data of the Document but I only get Null. Documentpicker is working, except: The Selected Data is NULL. async openDocumentReader() { try { const res = await DocumentPicker.pick({ type:…
Flo Sojer
  • 81
  • 8
1
vote
0 answers

UIDocument synchronous read - completion handler stalled in dispatch

I tried multiple ways of wrapping a file read within a synchronous method call (including using multiple queues, specifying target queues, setting up an NSThread and signalling with NSCondition's, even moving the allocation of the UIDocument to the…
1
vote
0 answers

How to prevent file name conflict when saving UIDocument to new URL without FileManager

Using FileManager it is possible to check if a file exists using the FileManager method fileExists(atPath:) when saving files to the App Sandbox. However, when working directly with UIDocument the saving method save(to:for:completion) can accept a…
MH175
  • 2,234
  • 1
  • 19
  • 35
1
vote
2 answers

How could one produce an icon from a document (based on file type), selected via UIDocumentationPickerController?

I am new fairly new to swift development but am obsessed and in love with learning, I have not only dedicated myself to learning but I am starting to apply my knowledge and have built a small messaging app with the capability to select a file. I…
user15787860
1
vote
0 answers

Swift UIDocument saving unreliable

Why is calling .save on an external (iCloud) UIDocument so tricky? :frowning: It either: takes forever and doesn't save, or save operation fails, despite of calling startAccessingSecurityScopedResource() prior to the save call. saves sometimes,…
Akash Agarwal
  • 2,326
  • 1
  • 27
  • 57
1
vote
0 answers

Using UISplitViewController with UIDocument

I am developing a Document based application (Imagine something like Keynote, with a table view containing the slides and a right part as editor). I would like to use the UISplitViewController as main View Controller for my document. Unfortunately,…
AP.
  • 5,205
  • 7
  • 50
  • 94
1
vote
0 answers

document saving on resign active expired with error Error

What does this mean: 2019-10-02 09:24:48.976268+0300 UP[2286:1341304] [UIDocumentLog] document saving on resign active expired with error Error Domain=RBSAssertionErrorDomain Code=1 "Assertion has already been invalidated"…
Anton Tropashko
  • 5,486
  • 5
  • 41
  • 66
1
vote
1 answer

How to ensure the order of list shown in UITableView when getting data for cell from UIDocument

My app fetches data via FileManager for each cell in UITableView. The cells need data from a file which requires open UIDocument objects. However, it seems like code inside open completion handler get executed non predictably, so the cells don't get…
Libertatem
  • 71
  • 1
  • 6
1
vote
1 answer

open document programmatically from UserDefaults in UIDocumentBrowserViewController

I am working on a document based app in swift using UIDocumentBrowserViewController. I would like the app to default to opening the previous file that was used in the last session. When exiting the app I save the file URL in UserDefaults. When I…
siege097
  • 83
  • 7
1
vote
1 answer

Adding thumbnail from image in UIDocument application

I have been trying to add a thumbnail image to the icon for a UIDocument application. The example I have been given is relatively straightforward. Assigning the image to a thumbnailDictionaryKey by overriding the fileAttributesToWrite function from…
jz_
  • 338
  • 2
  • 14
1
vote
1 answer

Create UIDocument on the fly in UIActivityItemProvider

I am using Core Data to store my user's data. I want to offer a Share button in the UI to export the data wherever they wish. I made a class conforming to UIActivityItemSource. It is successful when it simply returns a Data object from…
Bob Peterson
  • 636
  • 7
  • 16
1
vote
2 answers

swift iOS: create UIDocument in app documents folder

i am looking for a way how to do it. I say option how to work with files which are alredy created but UIDocument can not initialized only from URL. So, here is my code and it does not work: weak var weakSelf = self let toFolder =…
1
vote
1 answer

Document Renaming with UIDocumentBrowserViewController

I am using the "new way" of storing documents (iOS 11+) using UIDocumentBrowserViewController. No need for iCloud API, Entitlements etc. -- just works (under control of the separate Document Browser process). However, I haven't figured out how to…
habitoti
  • 229
  • 2
  • 15
1
vote
1 answer

How to delete using UIDocument

I am using Swift 4, and I need to know how to delete using UIDocument. I know how to set up the url path: if let url = try? FileManager.default.url( for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, …
Adam
  • 2,070
  • 1
  • 14
  • 18
1
vote
1 answer

Handling image load/store in a UIDocument that contains multiple images

I have a simple model object Location with a few text items and a images : [UIImages]?. Location is Codable so I store the text bits as JSON and then write the images into the same FileWrapper. My question is how to store the relationship between…
Maury Markowitz
  • 9,082
  • 11
  • 46
  • 98