Here's the Info.plist section <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeExtensions</key> <array> <string>typeA</string> </array> <key>CFBundleTypeIconFiles</key> <array/> <key>CFBundleTypeName</key> <string>Document Type A</string> <key>LSItemContentTypes</key> <array> <string>com.mycompany.typeA</string> </array> </dict> <dict> <key>CFBundleTypeExtensions</key> <array> <string>typeB</string> </array> <key>CFBundleTypeIconFiles</key> <array/> <key>CFBundleTypeName</key> <string>Document Type B</string> <key>LSItemContentTypes</key> <array> <string>com.mycompany.typeB</string> </array> </dict> </array> On Oct 23, 2013, at 3:10 PM, Mike Abdullah <mabdul...@karelia.com> wrote:
> > On 23 Oct 2013, at 13:08, Half Activist <halfactiv...@gmail.com> wrote: > >> Hello, >> >> In an iOS project, that is supposed to handle different kind of files, >> I declared in Info.plist the types handled, with two UTI types, say >> com.mycompany.typeA and com.mycompany.typeB. I also added the expected >> filename extensions for the two, suppose it's .typeA and .typeB. >> >> Now, I instantiate my UIDocument, with the following code: (all >> inspired by UIKit docs, I stripped off some details for the sake of >> lisibility, the file is guaranteed not to exist in the app folder.) >> >> NSString *newDocumentPath = [ AppDocumentPath() >> stringByAppendingPathComponent: @"NewDocument.typeA" ]; >> // Gives me a valid path to >> <AppHome>/Documents/NewDocument.typeA >> >> NSURL *newDocumentURL = [ NSURL fileURLWithPath: newDocumentPath ]; >> // Creates a file:// for that path. >> >> MyDocument *newDocument = [ [ MyDocument alloc ] initWithFileURL: >> newDocumentURL ]; >> // Instantiates the doc >> >> >> // Finally present. >> [ newDocument saveToURL: newDocumentURL >> forSaveOperation: UIDocumentSaveForCreating >> completionHandler: ^(BOOL success) { >> [ self presentViewController: >> newDocument.viewController animated: YES completion: ^(){} ]; >> } ]; >> >> >> There, in the process of saving, in UIDocument's - >> (id)contentsForType:(NSString *)typeName error:(NSError **)outError >> typeName is dyn.age81u5dmr3wu, not conforming to UTI for typeA or typeB. >> The url is correct. >> >> At any other point in the execution, fileType reports the wrong type. >> >> With a colleague, we tried on another app where it wasn't checked for >> since it handles only one file format, and it's exactly the same, fileType >> returns another UTI from the one declared in the Info.plist. >> >> All of this under iOS7. > > Show us the relevant portion of your Info.plist file too, please. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com