Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
检查用户是否使用iPhone上的graph API登录Facebook_Iphone_Facebook - Fatal编程技术网

检查用户是否使用iPhone上的graph API登录Facebook

检查用户是否使用iPhone上的graph API登录Facebook,iphone,facebook,Iphone,Facebook,我正在为iPhone使用Facebook图形API制作一份反馈表。当用户给出反馈时,我们要检查用户是否已经登录Facebook 任何人都可以帮忙 - (IBAction)submit:(id)sender { // This button pressed method check that user is already login or not } 请帮忙。谢谢 您可以通过在Appdelegate.m文件中写入以下代码来检查fb会话: - (void)applicationWil

我正在为iPhone使用Facebook图形API制作一份反馈表。当用户给出反馈时,我们要检查用户是否已经登录Facebook

任何人都可以帮忙

- (IBAction)submit:(id)sender {
    // This button pressed method check that user is already login or not 
}

请帮忙。谢谢

您可以通过在Appdelegate.m文件中写入以下代码来检查fb会话:

 - (void)applicationWillEnterForeground:(UIApplication *)application
    {
        /*
         Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
         */
        [self performSelector:@selector(checkingFBsession) withObject:nil afterDelay:1.0];

    }

-(void)checkingFBsession
{
   self.successfb= [[self facebook] isSessionValid];
    NSString *str = [[NSUserDefaults standardUserDefaults]objectForKey:@"access_token"];
    [str retain];
    NSLog(@"%@",str);
    if (self.successfb || str) {
        NSLog(@"session is valid !");

        accessToken=self.facebook.accessToken;
        [[NSUserDefaults standardUserDefaults]setObject:accessToken forKey:@"access_token"];
        [[NSUserDefaults standardUserDefaults]synchronize];

        accessToken = nil;
        accessToken = [[NSUserDefaults standardUserDefaults] objectForKey:@"access_token"];
      [accessToken retain];
        NSLog(@"at%@",accessToken);
        NSURL *url = [NSURL URLWithString:@"https://graph.facebook.com/me/feed"];
        ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
        [request setDelegate:self];
        [request addPostValue:[[NSUserDefaults standardUserDefaults]objectForKey:@"access_token"] forKey:@"access_token"];

        //    [request addPostValue:@"123456" forKey:@"telephone"];
        [request startAsynchronous];
        }


}

你在哪里初始化你的facebook?@dips:你找到这个问题的解决方案了吗?我也面临同样的问题。你能帮我解决这个问题吗?试着检查一下这里。你会找到解决方案: