objective-c - iOS 项目中的未知接收者 'jsonParser' 错误

标签 objective-c ios json facebook-graph-api

我在下面的代码中遇到了一些错误。错误是“使用未声明的标识符‘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." ];
        }
    }

Included a screenshot showing the JSON library in the project and the errors

最佳答案

而不是使用

SBJSON *jsonParser

使用:

SBJsonParser *jsonParser;

关于objective-c - iOS 项目中的未知接收者 'jsonParser' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10208799/

相关文章:

javascript - UIWebView 保存用户名和密码

ios - 由于 info.plist,存档提交失败

java - 在java中解析JSON?

javascript - 从外部文件加载 json

iphone - 核心数据 NSInvalidArgumentException 错误

iphone - 在控制台/文件中打印日志语句

objective-c - 如何在 MacGap 中打印 HTML 元素的内容?

ios - 较大设备中的自动布局问题

iOS swift native 谷歌共享错误消息,因为用户必须登录

ios - JSON 解析 iOS