martinatkinson
Registered
Hello!
I am having problems with the application I am trying to program. It is an app called "History Helper" and I have to make it save and open in text views as RTF files.
Here is what I have in my Document.m file:
#import "Document.h"
@implementation Document
- (NSString *)windowNibName
{
return @"Document";
}
- (void)windowControllerDidLoadNibNSWindowController *) aController;
{
[super windowControllerDidLoadNib:aController];
if (fileContents)
{
[textView replaceCharactersInRange:NSMakeRange(0,0) withRTF:fileContents];
[fileContents release];
fileContents = nil;
}
}
- (NSData *)dataRepresentationOfTypeNSString *)aType {
NSAssert([aType isEqualToString"rtf"], @"Unknown type");
return [textView RTFFromRange:NSMakeRange(0, [[textView textStorage] length])];
}
- (BOOL)loadDataRepresentationNSData *)data ofTypeNSString *)aType {
NSAssert([aType isEqualToString"rtf"], @"Unknown type");
fileContents = [data copyWithZone:[self zone]];
return YES;
}
@end
For some reason when I test this out and try to open an RTF file it gives me an error as follows "2002-02-23 11:51:14.249 PowerText[4025] *** Assertion failure in -[Document loadDataRepresentationfType:], Document.m:31
2002-02-23 11:51:14.253 PowerText[4025] Unknown type"
Do you have any suggestions?
Thank you so much!
Albert
I am having problems with the application I am trying to program. It is an app called "History Helper" and I have to make it save and open in text views as RTF files.
Here is what I have in my Document.m file:
#import "Document.h"
@implementation Document
- (NSString *)windowNibName
{
return @"Document";
}
- (void)windowControllerDidLoadNibNSWindowController *) aController;
{
[super windowControllerDidLoadNib:aController];
if (fileContents)
{
[textView replaceCharactersInRange:NSMakeRange(0,0) withRTF:fileContents];
[fileContents release];
fileContents = nil;
}
}
- (NSData *)dataRepresentationOfTypeNSString *)aType {
NSAssert([aType isEqualToString"rtf"], @"Unknown type");
return [textView RTFFromRange:NSMakeRange(0, [[textView textStorage] length])];
}
- (BOOL)loadDataRepresentationNSData *)data ofTypeNSString *)aType {
NSAssert([aType isEqualToString"rtf"], @"Unknown type");
fileContents = [data copyWithZone:[self zone]];
return YES;
}
@end
For some reason when I test this out and try to open an RTF file it gives me an error as follows "2002-02-23 11:51:14.249 PowerText[4025] *** Assertion failure in -[Document loadDataRepresentationfType:], Document.m:31
2002-02-23 11:51:14.253 PowerText[4025] Unknown type"
Do you have any suggestions?
Thank you so much!
Albert