在方法声明和调用上有一个奇怪的错误......
MyObject.h --- declarations. has been trimmed down
#import <Foundation/Foundation.h>
@interface MyObject : NSObject
- (void) useFlattenHTML;
- (NSString *) flattenHTML:(NSString *) inHtml;
- (NSString *) justAStringMethod;
@end
像这样定义和调用的方法......
MyObject.m --- method declaration and usage. Trimmed down
#import "MyObject.h"
@implementation MyObject
- (NSString *) flattenHTML:(NSString *) inHtml {
NSScanner *theScanner;
NSString *text = nil;
theScanner = [NSScanner scannerWithString:inHtml];
while ([theScanner isAtEnd] == NO) {
[theScanner scanUpToString:@"<" intoString:NULL] ;
[theScanner scanUpToString:@">" intoString:&text] ;
inHtml = [inHtml stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@>", text] withString:@""];
}
//
inHtml = [inHtml stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
return inHtml;
}
- (NSString *) justAStringMethod
{
// Some calls.
}
- (void) useFlattenHTML
{
NSString* resultStr = [self.flattenHTML @"Some html tagged string"];
NSString* anotherStr = [self.justAStringMethod];
}
@end
我明白了
Property 'flattenHTML' not found on object of type 'MyObject *'