2011-09-01 67 views
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];SBJSON + Facebook SDK的衝突幫助

任何人都知道我可以解決這個問題嗎?提前致謝!

// 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; 
    } 

回答