我在下面的代码中遇到了几个错误。错误是'使用未声明的标识符'SBJSON'和'未知接收器'jsonParser',你的意思是SBJsonParser'吗?
我的项目中有 JSON 库。它与 Facebook Graph API 和 Google Places 一起使用。出于某种原因,尽管下面的代码(也适用于 Facebook API)没有找到 JSON 文件。知道为什么吗?我想知道我是否将它们错误地拖放到项目中或其他什么。
谢谢你的帮助。
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
[self hideActivityIndicator];
NSString* responseString = [[[NSString alloc] initWithData:receivedData
encoding:NSUTF8StringEncoding]
autorelease];
NSLog(@"Response from photo upload: %@",responseString);
[self clearConnection];
// Check the photo upload server completes successfully
if ([responseString rangeOfString:@"ERROR:"].location == NSNotFound) {
SBJSON *jsonParser = [[SBJSON new] autorelease];
id result = [jsonParser objectWithString:responseString];
// Look for expected parameter back
if ([result objectForKey:@"image_name"]) {
productImageData = [result copy];
// Now that we have successfully uploaded the photo
// we will make the Graph API call to send our Wishlist
// information.
[self apiGraphAddToWishlist];
} else {
[self showAlertErrorMessage:@"Could not upload the photo." ];
}
} else {
[self showAlertErrorMessage:@"Could not upload the photo." ];
}
}