I am working on a text editor and I want to add RTFD support. After adding the RTFD file type to my Info.plist, I got the message that “readFromFileWrapper:ofType:error: must be overridden for your application to handle file packages.”
I had a look around in the documentation and found some things, but I didn’t manage to do everything..Could someone be so kind and help me out please?
- (BOOL)readFromFileWrapper:(NSFileWrapper *)fileWrapper ofType:(NSString *)typeName error:(NSError **)outError {
if ([typeName isEqualToString:@"Rich Text with Attachments"]) {
NSLog(@"Its RTFD");
//it gets to here but I don't know how to load the rtfd data then :(
}
ofType:typeName] return YES; }
Any help is apprechiated 🙂
RTFD is a particularly easy one, luckily. Check out the
readRTFDFromFile:andwriteRTFDToFile:atomically:methods ofNSText.From the NSText Class Reference:
If you’re coming from
NSURL, do something like this:To be safe, call
[[self url] isFileURL]first.