UIDocument with NSFileWrapper
UIDocument with NSFileWrapper
- Subject: UIDocument with NSFileWrapper
- From: email@hidden
- Date: Sat, 19 Mar 2016 13:18:04 -0400
I’m creating a document-based iPad app that I will want to persist the data (either using NSCoding or JSON or XML) along with auxiliary files that may be added, but won’t be modified much, if at all (i.e., image or PDF files the app displays but doesn’t modify). I have prior iOS experience writing apps using SQLite and Core Data in Objective-C although I’m using Swift for this app.
I’ve read through this:
https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/DocumentBasedAppPGiOS/CreateCustomDocument/CreateCustomDocument.html
and I think I see how NSFileWrapper works and how to use the
- (id)contentsForType:(NSString *)typeName error:(NSError **)outError
method.
The downside I see for my app is that UIDocument writes out the data to a temporary location and then moves it to the new location so I think my app will constantly be writing out these image/PDF files that never change. Is there a better way to do this so that the image/PDF files only get written out when they’re first added (or changed if they do get changed). The other data that is written out using NSCoding or JSON or XML will obviously change much more frequently.
I’ve also had trouble finding up to date/accurate information about how to export the document type. I’ve found these two but neither match the UI in Xcode 7.2/7.3 for doing this and it appears some of the plist keys are now different.
https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/DocumentBasedAppPGiOS/DocumentImplPreflight/DocumentImplPreflight.html
https://developer.apple.com/library/ios/qa/qa1587/_index.html
Is there something else I should be reading for how to do this in Xcode 7?
Thanks,
Dave Reed
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden