我已经formatSearchString
为一个类编写了一个方法,并试图在它实现之前在线调用它(没关系?)。我收到此错误:
Error: Semantic Issue
Use of undeclared identifier 'formatSearchString'
我正在使用 XCode 4.6.2
接口文件FHViewController.h
:
#import <Foundation/Foundation.h>
@interface FHViewController : UITableViewController
<UITableViewDataSource, UITableViewDelegate, NSURLConnectionDataDelegate>
@property(strong, nonatomic) NSString *searchTerm;
- (NSString *)formatSearchString:(NSString *)userEntry;
@end
实施文件FHViewController.m
:
#import "FHViewController.h"
@interface FHViewController()
- (NSString *)formatSearchString:(NSString *)userEntry;
@end
@implementation FHViewController
@synthesize searchTerm;
-(void)viewDidLoad
{
[super viewDidLoad];
NSString *formatted = [formatSearchString userEntry:searchTerm];
}
- (NSString *)formatSearchString:(NSString *)userEntry
{
NSLog(@"User Entry: %@", userEntry);
return @"Dummy string for now";
}
@end