我的執行文件中有一個錯誤,它一直在標記,我似乎無法修復。我已經評論了錯誤。我該如何解決這個錯誤?ARC語義問題,沒有可見的界面錯誤
#import "FilmSearchService.h"
@implementation FilmSearchService
@synthesize searchTerm;
@synthesize delegate;
@synthesize results;
-(void)main {
NSString *api_key = @"1234";
NSString *search_term = [searchTerm stringByAddingPercentEscapeUsingEncoding:NSASCIIStringEncoding]; // no visible @ interface for 'NSString' declares the selector 'stringByAddingPercentEscapeUsingEncoding'
NSString *url = [NSString stringWithFormat:@"http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=%@&q=%@", api_key, search_term];
NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:url]
cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
NSData *responseData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:nil error:nil];
if (responseData != nil) {
NSError *error = nil;
NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
if (error) {
[delegate serviceFinished:self withError:YES];
} else {
results = (NSArray *) [json valueForKey:@"movies"];
[delegate serviceFinished:self withError:NO];
}
} else {
[delegate serviceFinished:self withError:YES];
}
}@end
的filmsearchservice頭文件:
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "ServiceDelegate.h"
@interface FilmSearchService : NSOperation
{
NSString *searchTerm;
id<ServiceDelegate> delegate;
NSArray *results;
}
@property (nonatomic, retain) NSString *searchTerm;
@property (nonatomic, retain) id<ServiceDelegate> delegate;
@property (nonatomic, retain) NSArray *results;
@end
我道歉,如果這是一個比較簡單的問題來解決,我是很新,目標C,並感謝您的耐心。
謝謝。
什麼沒有可見的接口?你能提供更詳細的信息,看看你看到的確切錯誤嗎? – nhgrif
閱讀評論! – user1156596