uidocument

Returning method object from inside block

寵の児 提交于 2019-12-16 20:05:35
问题 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

Returning method object from inside block

戏子无情 提交于 2019-12-13 07:23:48
问题 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

How to Sync an NSDocument from iPad/iPhone to Mac osx with iCloud

坚强是说给别人听的谎言 提交于 2019-12-13 02:36:26
问题 How to Sync an nsdocument from ipad/iphone to Mac osx with icloud I managed to get it working! from Mac osx to iPhone/iPad but not from iPad/iPhone to Mac osx Here's my code from the subclassed nsdocument file on osx: Header file: #import <Cocoa/Cocoa.h> #import <Foundation/Foundation.h> @interface subclassedNSDocument : NSDocument @property (strong) NSData *myData; @end Implementation file: - (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError { BOOL

ios iphone hooks open instagram directly without showing UIDocumentInteractionController

若如初见. 提交于 2019-12-12 07:59:59
问题 I'm integrating sharing images through instagram in my app. I've read their documentation. It seems that I need to use the iOS UIDocumentInteractionController to allow this (I understand that it allows access to files in my app's sandbox). Digging deeper, I came across this library which makes things very straightforward. The problem I have with it is that it presents the action sheet (which only has one button - Instagram...) How can I use the instagram hooks , with the

iOS: How can I merge conflicted UIDocument's in iCloud?

烂漫一生 提交于 2019-12-11 10:08:09
问题 I'm having trouble understanding what my options are to merge 2 or more conflicted versions of a UIDocument stored in iCloud. After detecting the document conflict, I currently use removeOtherVersionsOfItemAtURL to simply keep the latest version of the document's data. However, I would like to support merging conflicted documents. The only resources and tutorials I found referred to Core Data and persistent stores for merging, and the examples used things like SQLite , which I don't use. In

Opening Several UIDocuments in Succession and Waiting for Them to Finish

旧街凉风 提交于 2019-12-11 08:05:00
问题 I'm having trouble getting my head around the way UIDocuments open asynchronously. I have a series of UIDocuments that the user has created. When the user presses a button I need to open some of the documents, pull some strings from them, and concatenate the strings into a new file. I have an array that keeps track of which documents need to be opened. My thought was that I should loop through the array, open each document, and append its contents to an NSMutableString . The problem is that

iOS Swift 3 Copy File to iCloud Drive Programatically

橙三吉。 提交于 2019-12-10 19:23:50
问题 In my I'm having documents download option. When users downloading documents from my app I need to store it to users iCloud Drive which was install in users mobile already. I have configured iCloud in both web and in Xcode, but problem is I'm not able to copy files to iCloud Drive correctly. File was downloaded successfully, and also it moving to iCloud but files won't appearing in iCloud Drive App. Here is my tried code: <key>NSUbiquitousContainers</key> <dict> <key>iCloud

UIDocument not saving?

五迷三道 提交于 2019-12-10 18:42:19
问题 No matter what I try, this isn't working... I am trying to use UIDocument to save my (text) files locally. When I create a file (i.e. it isn't loaded), it saves fine. However , if I load my file by opening it and then save it, it simply won't save. EDIT : I try to save my documents when the app enters the background. However, it seems that the app actually "finishes saving" the documents when I enter the foreground. Is my app not allowed to save documents while in the background? I've checked

Document Creation with UIDocumentBrowserViewController

百般思念 提交于 2019-12-10 13:41:45
问题 The documentation for documentBrowser(_:didRequestDocumentCreationWithHandler:) says, "Create a new document and save it to a temporary location. If you use a UIDocument subclass to create the document, you must close it before calling the importHandler block." So I created a file URL by taking the URL for the user's temporary directory ( FileManager.default.temporaryDirectory ) and appending a name and extension (getting a path like "file:///private/var/mobile/Containers/Data/Application

NSMetadataQuery does not find NSFileWrapper folder bundles, only files (but they're there)

时光怂恿深爱的人放手 提交于 2019-12-10 11:33:02
问题 I have a strange problem which I can't seem to solve on my own. Any help or thought is appreciated. The problem: NSMetadataQuery finds normal files (like test.txt) but no filewrapper bundle (myWrapperDocument.pro) However, NSFileManager finds all files in my ubiquity container - so the files are there, but NSMetadataQuery doesn't find them! The facts: UIDocument based app using NSFileWrappers Shared Ubiquity Container (for iOS and Desktop app) Works perfect on Mac OS Works perfect on my iPad