【问题标题】:Help with SBJSON + Facebook SDK Clash帮助解决 SBJSON + Facebook SDK 冲突
【发布时间】:2011-09-01 02:57:37
【问题描述】:

我使用的是来自this JSON tutorial 的 SBJSON 文件,然后我尝试使用 Facebook iOS SDK。 Facebook SDK 恰好有相同的 SBJSON 文件。但显然有很大不同。我不能同时使用这两个文件夹组,因为我在 Xcode 中遇到“重复错误”。我尝试删除原始 JSON 文件夹组,现在我收到以下警告:SBJsonParser may not respond to objectWithString:error:SIGABRT 在此行崩溃:return [jsonParser objectWithString:jsonString error:NULL];

有人知道我该如何解决这个问题吗?提前致谢!

// JSON from Server Actions
- (NSString *)stringWithUrl:(NSURL *)url {
    NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url
                                                cachePolicy:NSURLRequestReloadRevalidatingCacheData
                                            timeoutInterval:30];
    // Fetch the JSON response
    NSData *urlData;
    NSURLResponse *response;
    NSError *error;

    // Make synchronous request
    urlData = [NSURLConnection sendSynchronousRequest:urlRequest
                                    returningResponse:&response
                                                error:&error];

    // Construct a String around the Data from the response
    return [[NSString alloc] initWithData:urlData encoding:NSUTF8StringEncoding];
    }



- (id)objectWithUrl:(NSURL *)url {
    SBJsonParser *jsonParser = [SBJsonParser new];
    NSString *jsonString = [self stringWithUrl:url];

    // Parse the JSON into an Object
    return [jsonParser objectWithString:jsonString error:NULL];
    }

- (NSDictionary *)downloadManifest {
    id response = [self objectWithUrl:[NSURL URLWithString:@"http://example.com/manifest.json"]];
    NSDictionary *feed = (NSDictionary *)response;
    return feed;
    }

【问题讨论】:

    标签: iphone json facebook sbjson


    【解决方案1】:

    【讨论】:

    • 您是否因为没有解决方案而最终使用了新的 JSON 解析器?恕我直言,切换 JSON 库似乎不是一个很好的解决方案。
    猜你喜欢
    • 1970-01-01
    • 2011-05-17
    • 1970-01-01
    • 2012-05-15
    • 1970-01-01
    • 1970-01-01
    • 2015-12-18
    • 2018-02-23
    • 1970-01-01
    相关资源
    最近更新 更多