私は の新人ですxcode
。エラーが発生しない理由がわかりませんXcode
が、実行するとシミュレーターがロードされ続け、エラーがスローされます。英語が下手で申し訳ありません。データの解析時に何か問題があると思いますが、修正方法がわかりません。
- (void)performSearch
{
if ([self.searchBar.text length] > 0) {
[self.searchBar resignFirstResponder];
[queue cancelAllOperations];
[[AFImageCache sharedImageCache] removeAllObjects];
[[NSURLCache sharedURLCache] removeAllCachedResponses];
isLoading = YES;
[self.tableView reloadData];
searchResults = [NSMutableArray arrayWithCapacity:10];
NSURL *url = [self urlWithSearchText:self.searchBar.text category:self.segmentedControl.selectedSegmentIndex];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
NSLog(@"REQUEST: %@", request);
AFJSONRequestOperation *operation = [AFJSONRequestOperation
JSONRequestOperationWithRequest:request
success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
NSLog(@"Success!");
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {
NSLog(@"Failure! %@", error);
}];
[operation start];
[operation waitUntilFinished];
// ???
[queue addOperation:operation];
}
}
2012-11-23 11:30:12.429 StoreSearch[5803:c07] REQUEST: <NSURLRequest http://itunes.apple.com/search?term=tr&limit=200&entity=>
2012-11-23 11:30:14.202 StoreSearch[5803:c07] *** WebKit discarded an uncaught exception in the webView:shouldInsertText:replacingDOMRange:givenAction: delegate: <NSInvalidArgumentException> *** -[NSOperationQueue addOperation:]: operation is finished and cannot be enqueued
2012-11-23 11:30:14.211 StoreSearch[5803:c07] Failure! Error Domain=com.alamofire.networking.error Code=-1016 "Expected content type {(
"text/json",
"application/json"
)}, got text/javascript" UserInfo=0xdf348b0 {NSErrorFailingURLKey=http://itunes.apple.com/search?term=tr&limit=200&entity=, NSLocalizedDescription=Expected content type {(
"text/json",
"application/json"
)}, got text/javascript}