图APi 2.1搜索附近的地方facebook api

时间:2014-10-07 05:47:35

标签: ios facebook-graph-api

我正在使用社交网络框架图形api 2.1 我无法访问附近的地方。错误是{code = 100; message =“没有指定节点”; type = GraphMethodException; };

我的代码:

 -(void) getLocation
    {
        NSString *centerString = [NSString stringWithFormat: @"%f,%f",self.latitude, self.longitude];

        CAAppDelegate *appDelegate = (CAAppDelegate *) [[UIApplication sharedApplication] delegate];
        NSArray *permissionArray = @[@"user_about_me",@"user_birthday", @"user_events",  @"user_friends", @"user_hometown",@"user_likes",    @"user_location",@"user_status",@"user_work_history",@"public_profile",@"email"];
        ACAccountType *facebookAccountType2  = [appDelegate.accountStore accountTypeWithAccountTypeIdentifier:
                                                ACAccountTypeIdentifierFacebook];
         NSString *acessToken = appDelegate.facebookAccount.credential.oauthToken;
        ACAccount *fbAccount2 = [[appDelegate.accountStore accountsWithAccountType:facebookAccountType2] lastObject];
        NSDictionary *paramDictionary = [NSDictionary dictionaryWithObjectsAndKeys:permissionArray,ACFacebookPermissionsKey, acessToken, @"acess_token",@"q",
                                         @"place",@"type",
                                         centerString,@"center",
                                         @"10000",@"distance",@"fields",  nil];
        NSURL *requestURL = [NSURL URLWithString:@"https://graph.facebook.com/search"];
        SLRequest *fbShareRequest = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:requestURL parameters:paramDictionary];
        fbShareRequest.account = fbAccount2;
        [fbShareRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
            __block NSError *errorno = error;
            dispatch_sync(dispatch_get_main_queue(), ^{

                [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
                if(!error)
                {
                    NSDictionary *json =[NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&errorno];



                    NSLog(@"Dictionary contains data: %@", json );


                }
            });
        }];
    }

0 个答案:

没有答案