0

I'm trying to open a file, and I'm currently implementing

- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError

from within the NSDocument subclass. (Documentation for above method)

For some reason, typeName is returning as a string "DocumentType". I thought its supposed to be the file extension of the file opened, but now I'm not sure.

Is this correct? How do I error check to make sure the user didn't open an unsupported file type? Thanks

rmaddy
  • 314,917
  • 42
  • 532
  • 579
user339946
  • 5,961
  • 9
  • 52
  • 97
  • I just realized that DocumentType is a default string in the Info.plist. My question is, if my app only opens things like jpg, png, do I need to customize my own DocumentType? – user339946 Sep 28 '16 at 20:03
  • Does your `NSDocument` subclass represent a jpg/png file or do you save your documents in a custom format? – Willeke Sep 28 '16 at 21:44
  • Neither, am I using NSDocument based app incorrectly in this case? – user339946 Sep 29 '16 at 05:00

0 Answers0