First of all thanks for responding to my question.
UIManagedDocument is a subclass of UIDocument. And the documentation of UIDocument say’s to create a subclass of UIDocument and override two methods contentsForType:error and loadFromContents:ofType:error and create your own NSFileWrapper objects if you like (or must).
NSFileWrapper on its behalf can create 3 kinds of files:
a Regular-file file wrapper (which is the one i’am looking for)
a Directory file wrapper (which to one i’am getting now)
and a Symbolic-link file wrapper (which is of no use for me)
Initially a UIManagedDocument object with support for iCloud creates a directory on the iCloud-drive and in that directory it creates yet another directory and in there it puts my database-file and an SHM- and a WAL-file.
So I end up with some directory’s and my database files.
The solution I’am looking for is a “Regular-file file wrapper” so that there will be only one file which includes my database files instead of a directory with a bunch of database files.
There are some code snippets and sample projects on how to create a custom filewrapper in a UIDocument based object, but to my knowledge there are no samples on how to customize UIManagedDocuments objects to support a single file database.
In a UIDocument object you can create and manage the filewapper yourself, but the problem I’am struggling with is that the database files which UIManagedDocument creates isn’t something I manage myself, its done by CoreData’s store coordinator.
Note:
I already inserted the following code in my info.plist
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>boxdat</string>
</array>
<key>CFBundleTypeIconFiles</key>
<array>
<string>Icon-iPad-doc320.png</string>
<string>Icon-iPad-doc.png</string>
<string>Icon-iPhone-doc44.png</string>
<string>Icon-iPhone-doc.png</string>
<string>Icon-iPad-doc320</string>
</array>
<key>CFBundleTypeName</key>
<string>Boxdat Database</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.johan.managedDocuments.boxdat</string>
</array>
<key>LSTypeIsPackage</key>
<string>YES</string>
</dict>
</array>