Reputation: 1564
Have a weird error on method declaration and call...
MyObject.h --- declarations. has been trimmed down
#import <Foundation/Foundation.h>
@interface MyObject : NSObject
- (void) useFlattenHTML;
- (NSString *) flattenHTML:(NSString *) inHtml;
- (NSString *) justAStringMethod;
@end
And method defined and called like this...
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
I get
Property 'flattenHTML' not found on object of type 'MyObject *'
Upvotes: 0
Views: 603
Reputation: 11724
Maybe because you're using the dot notation in a case where it doesn't make much sense :
in useFlattenHTML
method, self.flattenHTML
is the same as [self flattenHTML]
, which doesn't exist, as you only have [self flattenHTML:someString]
.
On top of that, dot notation is possible, but you should keep it for fields declared as @property
only
Upvotes: 3