以编程方式关闭facebook窗口

时间:2013-05-23 14:13:29

标签: ios facebook

我的要求是在某些条件下通过代码关闭Facebook窗口。 我正在使用 Facebook iOS SDK 3.5.1。

有没有办法在运行应用程序时显示(Facebook)屏幕或以编程方式关闭Facebook屏幕?

我正在使用facebook进行2场景 -

  1. 登录
  2. 用于发送应用请求。
  3. 两者的代码均低于 -

    1。登录:

    AppDelegate *appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
    if (appDelegate.session.state != FBSessionStateCreated || !appDelegate.session.isOpen) {
        // Create a new, logged out session.
        NSArray *permissions = [NSArray arrayWithObjects:@"publish_stream",@"user_birthday",@"user_photos", @"email", @"user_location", @"user_hometown", nil];
        appDelegate.session = [[FBSession alloc] initWithPermissions:permissions];
    }
    
    [appDelegate.session openWithCompletionHandler:^(FBSession *session,
                                                     FBSessionState status,
                                                     NSError *error) {
        if (appDelegate.session.state!=258 && appDelegate.session.state!=257) {
            [self accessTokenFound:appDelegate.session.accessToken];
        }
    }];
    

    2。对于应用请求

    NSMutableDictionary* params = [NSMutableDictionary dictionary];
    AppDelegate* appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
    [params setObject:friendID forKey:@"to"];
    
    // Display the requests dialog
    [FBWebDialogs
     presentRequestsDialogModallyWithSession:appDelegate.session
     message:message
     title:nil
     parameters:params
     handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
         if (error) {
             NSLog(@"Error sending request.");
         } else {
             if (result == FBWebDialogResultDialogNotCompleted) {
                 NSLog(@"User canceled request.");
             } else {
                 NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
                 if (![urlParams valueForKey:@"request"]) {
                     NSLog(@"User canceled request.");
                 } else {
                     NSString *requestID = [urlParams valueForKey:@"request"];
                     [self requestSentSuccessfully];
                 }
             }
         }
     }];
    

0 个答案:

没有答案