首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Facebook Ios sdk登录

Facebook Ios sdk登录
EN

Stack Overflow用户
提问于 2013-02-15 03:43:55
回答 1查看 232关注 0票数 0

我正在尝试创建一个函数与iOS facebook sdk,我将能够登录,如果我登录,我将能够看到nslog字符串“已登录”。然而,我根本看不到它的字符串。此外,在按下按钮、查看我的Facebook应用程序和按下ok继续操作方面,登录似乎工作得很好。有人能告诉我我哪里做错了吗?

代码语言:javascript
复制
   -(IBAction)popButton:(id)sender {

   TUAppDelegate *appDelegate = (TUAppDelegate *)[[UIApplication sharedApplication] delegate];

// this button's job is to flip-flop the session from open to closed
if (appDelegate.session.isOpen) {
    // if a user logs out explicitly, we delete any cached token information, and next
    // time they run the applicaiton they will be presented with log in UX again; most
    // users will simply close the app or switch away, without logging out; this will
    // cause the implicit cached-token login to occur on next launch of the application
    [appDelegate.session closeAndClearTokenInformation];

} else {
    if (appDelegate.session.state != FBSessionStateCreated) {
        // Create a new, logged out session.
        appDelegate.session = [[FBSession alloc] init];
    }

    // if the session isn't open, let's open it now and present the login UX to the user
    [appDelegate.session openWithCompletionHandler:^(FBSession *session,
                                                     FBSessionState status,
                                                     NSError *error) {
        // and here we make sure to update our UX according to the new session state
        [self updateView];
    }];
}
  }
- (void)updateView{
// get the app delegate, so that we can reference the session property
  TUAppDelegate *appDelegate = (TUAppDelegate *)[[UIApplication sharedApplication] delegate];
if (appDelegate.session.isOpen) {
    NSLog(@"Logged In");

} else {
    NSLog(@"Not Logged In");
}
}
EN

回答 1

Stack Overflow用户

发布于 2013-07-12 05:27:19

我怀疑您至少错过了步骤2d,将openURL连接回Facebook SDK:

https://developers.facebook.com/docs/tutorials/ios-sdk-tutorial/authenticate/

..。也就是说,你很容易错过更多。如果你在登录后再次看到你的应用程序,那么我怀疑你已经将网址方案添加到了你的Info.plist中,否则也要检查一下。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14882773

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档