我有3个链接请求:1.fbRequest和2.meRequest是相同的。 3. thirdPartyIdRequest meRequest和thirdPartyIdRequest依赖于fbRequest。
运行此命令时,每次fbRequest返回一个空响应字典,而meRequest(这是第二次调用的相同调用)和thirdPartyIdRequest返回有效响应。我不确定为什么会这样。
NSDictionary *dictionary = @{@"fields": @"id, first_name, middle_name, last_name, email, picture.type(large)"};
NSDictionary *dictionaryThirdPartyIdRequest = @{};
FBSDKGraphRequest *fbRequest = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:dictionary HTTPMethod:@"GET"];
FBSDKGraphRequest *meRequest = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:dictionary HTTPMethod:@"GET"];
FBSDKGraphRequest *thirdPartyIdRequest = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"custom_audience_third_party_id"
parameters:dictionaryThirdPartyIdRequest
HTTPMethod:@"GET"];
FBSDKGraphRequestConnection *connection = [[FBSDKGraphRequestConnection alloc] init];
//request me
[connection addRequest:fbRequest
completionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
//TODO: process me information
NSLog(@"result fbRequest %@",(NSDictionary *)result);
} batchEntryName:@"fbRequest"];
//request addRequest:thirdPartyIdRequest ok
[connection addRequest:thirdPartyIdRequest
completionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
//TODO: process like information
NSLog(@"result thirdPartyIdRequest %@",(NSDictionary *)result);
} batchParameters:@{@"depends_on" : @"fbRequest"}];
//request me ok
[connection addRequest:meRequest
completionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
//TODO: process like information
NSLog(@"result meRequest %@",(NSDictionary *)result);
} batchParameters:@{@"depends_on" : @"fbRequest"}];
[connection start];