首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SBJSON + Facebook SDK Clash的帮助

SBJSON + Facebook SDK Clash的帮助
EN

Stack Overflow用户
提问于 2011-09-01 10:57:37
回答 1查看 831关注 0票数 0

我正在使用来自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];

有人知道我怎么解决这个问题吗?提前感谢!

代码语言:javascript
复制
// 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;
    }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-09-01 12:18:35

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7265696

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档