uidocument

Xcode 9.2 UIDocumentBrowserViewController : Failed to create a url from bookmarkableString

点点圈 提交于 2020-01-11 19:59:07
问题 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 URL." UserInfo={NSLocalizedDescription=The reader is not permitted to access the URL.} [DocumentManager] Failed to create a url from bookmarkableString (Error Domain=NSFileProviderInternalErrorDomain Code=1 "The reader is not permitted to access the

Does NSFileWrapper load everything into memory?

泄露秘密 提交于 2019-12-29 07:07:29
问题 Lets say I have an NSFileWrapper directory. This directory is made up of several levels of directories and files. Some of the files are large. Are all these files loaded into memory, or are they lazily loaded? If they are loaded into memory, are there any alternatives to NSFileWrapper with similar functionality that won't load files into memory? Something I can hook into UIDocument ? This is for a document based application, which uses UIDocument 's that are synced with iCloud. A document can

subclassing initWithFileURL of an UIDocument

风格不统一 提交于 2019-12-25 09:08:54
问题 I'm trying to overwrite the initWithFileURL of an UIDocument as I need to call some custom methods once an UIDocument is initialised. I thought this may be a good idea: -(id)initWithFileURL:(NSURL *)url { self = [super initWithFileURL:url]; // do some custom stuff return self; } Is there anything else I need to do if I overwrite this? I have the feeling that I need to check for NIL or something. Where do you usually look if you need to overwrite a method with something custom? I was only able

Returning method object from inside block

痞子三分冷 提交于 2019-12-25 05:06:47
问题 I am wondering how to do the following correctly: I have a method that is to return an NSData object. It gets the NSData object from a UIDocument . The NSData object can get large, so I want to make sure it is fully loaded before the response starts. I would therefore like to return the value of the method from within the block itself. So something like this: - (NSData*)getMyData { MyUIDocument *doc = [[MyUIDocument alloc] initWithFileURL:fileURL]; [doc openWithCompletionHandler:^(BOOL

UIDocument never calling dealloc

旧巷老猫 提交于 2019-12-23 19:45:24
问题 I have an issue where I can't seem to dealloc UIDocument (used in iCloud) After running an NSMetaDataQuery to look for the document as follows.. NSMetadataQuery *query = [[NSMetadataQuery alloc] init]; _query = query; [query setSearchScopes:[NSArray arrayWithObject: NSMetadataQueryUbiquitousDocumentsScope]]; NSPredicate *pred = [NSPredicate predicateWithFormat: @"%K == %@", NSMetadataItemFSNameKey, kFILENAME]; [query setPredicate:pred]; [[NSNotificationCenter defaultCenter] addObserver:self

UIDocument autosave not working when calling updateChangeCount

人走茶凉 提交于 2019-12-23 03:45:28
问题 I have a custom subclass of UIDocument that I use to store the user's content for my app. I call -[UIDocument updateChangeCount:UIDocumentChangeDone] directly to track changes to the document. Saving and loading work fine, but the document never autosaves. Why would this be happening? 回答1: It turns out that the problem was that I wasn't calling -[UIDocument updateChangeCount:] from the main thread. Despite the fact that UIDocument isn't a UI element, it is still part of UIKit and so the usual

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

不羁岁月 提交于 2019-12-21 10:14:35
问题 I have a UIDocument based app that uses NSFileWrapper s 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 a small proportion of one page has been modified, UIDocument spends a LONG time in the background writing the changes (in writeContents:andAttributes:safelyToURL:forSaveOperation:error: ). Surely it should only be writing out this one small change

UIDocument not saving to file despite indicating success

廉价感情. 提交于 2019-12-20 11:13:08
问题 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 . However, the iCloud file (as seen in both desktop and iOS file browser) does not update, and when reopening the file, the changes are not shown. I've verified that contents(forType:) returns the correct (modified) file contents when saving.

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

纵饮孤独 提交于 2019-12-17 17:58:13
问题 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 debugger, it looks successful, but when I check to see if the file exists or at least the iCloud directory, there is nothing there. I tried on both the simulator and my iPhone, triggering iCloud synching, and everything else I can think of. My main goal