iosobjective-ccore-datauimanageddocument

How to get UIManagedDocument to show up as a file package and not a folder


I'm working on a Core Data document based application, using a UIManagedObject subclass as my storage container.

When saving the file (to iTunes File Sharing) the file shows up as a folder, instead of a file package. I'd like it to show up as a single file so users can't accidentally mess with the file structure.

Here's what I've done so far. In my subclass :

@implementation

- (NSString *)savingFileType {
    return @"com.app.filetype";
}

- (NSString *)fileNameExtensionForType:(NSString *)typeName
                         saveOperation:(UIDocumentSaveOperation)saveOperation {
    return @"ext";
}

@end

In the target info, I register the exported UTI :

enter image description here


Solution

  • And... I finally figured it out.

    In the "Exported UTIs" section of your info.plist, add "com.apple.package" to the "Conforms To" field of your custom UTI.enter image description here