简体   繁体   English

如何从ios应用程序中的WITHIN连接到FB?

[英]how do I connect to FB from WITHIN my ios app?

I have a popular medicine app often used by med students and residents at the bedside. 我有一个流行的医学应用程序,经常被医学生和床边的居民使用。 I incorporated the new FB SKD into my last updated which, when opened for the first time (and subsequently if not used for a few days), opens the native FB app then redirects to my app. 我将新的FB SKD合并到我的上次更新中,该文件在首次打开时(如果几天不使用,则在随后打开)时打开本机FB应用程序,然后重定向到我的应用程序。 Many customers have complained because the info within the app often needs to be looked up quickly (crashing patient). 许多客户抱怨说,因为应用内的信息通常需要快速查找(导致患者崩溃)。

Is it possible to set up my app so the user needs to click on a button within the app before connecting to FB? 是否可以设置我的应用程序,以便用户需要在连接到FB之前单击应用程序中的按钮? Thanks! 谢谢!

I think you will need to make change to authorizeWithFBAppAuth method in facebook.m file of the SDK. 我认为您需要对SDK的facebook.m文件中的authorizeWithFBAppAuth方法进行更改。

This SO has a suggestion for you. SO对你的建议。

When you download the FB SDK you get a sample project. 下载FB SDK时,您将获得一个示例项目。 Compile and run it, and you should see a toggle button that allows user to login/logout. 编译并运行它,您应该看到一个允许用户登录/注销的切换按钮。 You've got the FB official images in that project, and the code behind it is pretty simple: 您已经在该项目中获得了FB官方图像,其背后的代码非常简单:

 
/**
 * Called on a login/logout button click.
 */
- (void)fbButtonClick:(id)sender {
    if (fbButton.isLoggedIn) {
        [self logout];
    } else {
        [self login];
    }
}

/**
 * Show the authorization dialog.
 */
- (void)login {
    [_facebook authorize:nil delegate:self];
    NSLog(@"Sas");


}

/**
 * Invalidate the access token and clear the cookie.
 */
- (void)logout {

    [_facebook logout:self];

}

You should also change the button's state in the FBAuth delegate methods (which you've already implemented) by calling a method similar to this one: 您还应该通过调用类似于以下方法的方法在FBAuth委托方法(已实现)中更改按钮的状态:


- (void)updateFbButtonAccordingToSessionStatus {

    //Check if session is valid and update button accordingly
    if ([self.facebook isSessionValid] == NO ) {

        fbButton.isLoggedIn = NO;
        [fbButton updateImage];


    }
    else {

        fbButton.isLoggedIn = YES;
        [fbButton updateImage];        

    }


}

Hope this helps. 希望这可以帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我需要允许一个应用程序用户从我的应用程序在他们的fb上发布一些东西作为其状态……我需要什么? fb连接? - I need to allow an app user to post something on their fb as their status, from with my app…what do I need? fb connect? 当我在FB桌面上看到消息时,FB messenger如何从iOS应用程序中删除推送通知? - How does FB messenger removes push notification from iOS app when I see the message on FB Desktop? 如何在无法连接到Mac的iPhone上启动ios应用 - How to launch an ios app on an iphone that I cannot connect to my mac 如何在API .js上连接我的iOS应用 - How to connect my iOS app on API .js 我正在使用facebook ios sdk 3.0登录到我的应用程序fb登录正常工作,但未连接到该应用程序吗? - I am using facebook ios sdk 3.0 for logging into my app fb login working but not connecting to the app? iOS:从多任务栏恢复应用程序时,如何保持方向? - iOS: How do I maintain my orientation when resuming the app from the multitask bar? 如何阻止MPMoviePlayerController在iOS4.0 +中的iPod控件上显示我的应用程序图标? - How do I stop MPMoviePlayerController from showing my app's icon on the iPod controls in iOS4.0+? 从iTunes获取有效的产品连接需要在iOS中进行应用内购买。 我该如何处理? - Fetching valid products from itunes connect for in app purchase in iOS takes a lot of time. How do I deal with it? 如何在iOS应用中删除对英语的支持? - How do I remove support for English in my iOS app? OCUnit-iOS 5-如何在我的应用程序中测试文件? - OCUnit - iOS 5 - How do I test files in my app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM