Clarification on UIDocument in iOS 5

590 views Asked by At

I need a little clarification working with UIDocument and I have 3 related questions

-1. In the call:

-(id)contentsForType:(NSString *)typeName error:(NSError **)outError

from where does the UIDocument pickup the typeName. Is it from "Document types" in the info.plist of the app if the value is set for that property.

-2. Can one have more than 1 document type for an iOS app, and then if so, how can one determine which type is used when saving and reading documents.

-3. Does UIDocument work in the simulator?

1

There are 1 answers

0
reza23 On

So Here is what I have found out probably solving the issues.

-1. in your UIDocument subclass if you want to use a custom type, you need override the call: "-( NSString *)fileType" returning your custom fileType you want to use. Then this file type is used when UIDocument subclass calls function:

-(id)contentsForType:(NSString *)typeName error:(NSError **)outError

-2. In this way you can have more than one document type for an application as you can return different fileTypes in "-( NSString *)fileType"

-3. Contrary to what I have read, I seem to have managed to be able to save a UIDocument using the simulator. My previous issue was a poor bug.

I hope this helps

Reza