2012-04-18 12 views
1

私は以下のようにしたいと思いますが、うまくいきません。facebook-ios-sdkリクエストの名前とプロフィールの画像が入力できない

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"first_name,picture?type=normal", @"fields",nil]; 
[facebook requestWithGraphPath:@"me" andParams:params andDelegate:self]; 

私は1つのリクエストでそれらをrequstしたい場合は、私が使用していますFacebookの-IOS-SDKはそれを行う方法を、here

です?ありがとう。

私は

NSString *jsonRequest1 = @"{ \"method\": \"GET\", \"relative_url\": \"me?fields=first_name\" }"; 
NSString *jsonRequest2 = @"{ \"method\": \"GET\", \"relative_url\": \"me/picture?type=square\" }"; 
NSString *jsonRequestsArray = [NSString stringWithFormat:@"[ %@, %@ ]", jsonRequest1, jsonRequest2]; 
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObject:jsonRequestsArray forKey:@"batch"]; 
[facebookDelegate requestWithGraphPath:@"me" andParams:params andHttpMethod:@"POST" andDelegate:self]; 

のようなバッチ要求を使用し、私が得た結果

({ 
body = "{\"first_name\":\"Eric\",\"id\":\"100003742445201\"}"; 
code = 200; 
headers =  (
      { 
     name = "Access-Control-Allow-Origin"; 
     value = "*"; 
    }, 
      { 
     name = "Cache-Control"; 
     value = "private, no-cache, no-store, must-revalidate"; 
    }, 
      { 
     name = Connection; 
     value = close; 
    }, 
      { 
     name = "Content-Type"; 
     value = "text/javascript; charset=UTF-8"; 
    }, 
      { 
     name = ETag; 
     value = "\"3be1c3dfc20761062712ae899cc7c402062300a7\""; 
    }, 
      { 
     name = Expires; 
     value = "Sat, 01 Jan 2000 00:00:00 GMT"; 
    }, 
      { 
     name = Pragma; 
     value = "no-cache"; 
    } 
);}, 
{ 
body = "<null>"; 
code = 302; 
headers =  (
      { 
     name = "Access-Control-Allow-Origin"; 
     value = "*"; 
    }, 
      { 
     name = "Cache-Control"; 
     value = "private, no-cache, no-store, must-revalidate"; 
    }, 
      { 
     name = Connection; 
     value = close; 
    }, 
      { 
     name = "Content-Type"; 
     value = "image/jpeg"; 
    }, 
      { 
     name = Expires; 
     value = "Sat, 01 Jan 2000 00:00:00 GMT"; 
    }, 
      { 
     name = Location; 
     value = "http://profile.ak.fbcdn.net/hprofile-ak-snc4/573359_100003742445201_1494953237_q.jpg"; 
    }, 
      { 
     name = Pragma; 
     value = "no-cache"; 
    } 
); 
} 
) 

プロフィール画像が正しい位置にありません。どうして?ここ

+0

プロファイルイメージは2番目のヘッダーにあり、2番目の呼び出しです。それが正しいように私に見えます。 –

答えて

0


IOS-SDKを使用して、サンプルバッチは、完全例えばhttps://stackoverflow.com/a/5503010/912623を指しています。

-(void) prepareMyBatchRequest { 
    NSString *jsonRequest1 = @"{ \"method\": \"GET\", \"relative_url\": \"me?fields=first_name,picture\" }"; 
    NSString *jsonRequest2 = @"{ \"method\": \"GET\", \"relative_url\": \"me\" }"; 
    NSString *jsonRequestsArray = [NSString stringWithFormat:@"[ %@, %@ ]", jsonRequest1, jsonRequest2]; 
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObject:jsonRequestsArray forKey:@"batch"]; 
    [facebook requestWithGraphPath:@"me" andParams:params andHttpMethod:@"POST" andDelegate:self]; 
} 
関連する問題