2012-04-18 11 views
0

以下のコードでいくつかのエラーが表示されます。エラーは '宣言されていない識別子' SBJSON 'と'不明な受信者 'jsonParser'を使用しています.SBJsonParser 'を意味しましたか?iOSプロジェクトで不明な受信者 'jsonParser'エラーが発生しました

私のプロジェクトには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

+1

をインポートしましたが

また、あなたが参照しているファイルがSBJSON.hをインポートしていることを確認してください? – Matthias

+0

ヘッダ#import SBJSON.hは、FBConnect.hファイルを介してインポートされます。それは次のインポートのディレクティブを持っています。#include "Facebook.h" の#include "FBDialog.h" の#include "FBLoginDialog.h" の#include "FBRequest.h" の#include "SBJSON.h" – hanumanDev

答えて

1

enter image description here

あなたがこのプロジェクトに含まれるファイルしていると、すべての.mファイルがターゲットの「ソースをコンパイル」リストにあることを確認してください。

#import "SBJSON.h" 
+0

感謝!すべてのFacebook APIファイルを含むsrcフォルダをJSONファイルと共にプロジェクトに移動しました。私は別のフォルダに移動しましたが、プロジェクトには直接移動しませんでした。 – hanumanDev

3

の代わりに使用

SBJSON *jsonParser 

使用して:あなたは、ヘッダーを

SBJsonParser *jsonParser; 
関連する問題