English 中文(简体)
土著SOSFacebook SSO获得回馈。
原标题:Native iOS Facebook SSO won t return to app

看来,这似乎是一种重复,但我已经通过围绕该问题提出的所有问题,而且我似乎仍然无法为我所想。

我在Facebook开发点跟踪了Sitorial,我做了以下工作:

  1. Created a Facebook App to get the Facebook App ID.
  2. I ve assigned this App ID to a constant and I use it to initialize the Facebook object within my app.
  3. I ve made sure my app is flagged for multitasking
  4. I ve setup the fbAPP_ID in the plist under the URLs drop down
  5. I ve made my AppDelegate a FBSessionDelegate and implemented very simple fbDidLogin and fbDidNotLogin delegate methods.

FCCC/SBI/2008/8。

All of this and I still can t seem to get Facebook to return control back to my app when it authorizes. It just stays in Facebook instead.

法典(注FB_APP_ID) 此处改为基本数字

AppDelegate.h:

#import <UIKit/UIKit.h>
#import "FBConnect.h"

#define FB_APP_ID @"1234567890"

@interface AppDelegate : UIResponder <UIApplicationDelegate, FBSessionDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (nonatomic, strong) Facebook* facebook;

@end

AppDelegate.m:

#import "AppDelegate.h"

@implementation AppDelegate
@synthesize window = _window;
@synthesize facebook = _facebook;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    _facebook = [[Facebook alloc] initWithAppId:FB_APP_ID andDelegate:self];
    if (![_facebook isSessionValid])
    {
        [_facebook authorize:nil];
    }
}

- (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL *)url
{
    return [_facebook handleOpenURL:url];
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    return [_facebook handleOpenURL:url];
}

- (void)fbDidLogin
{
    NSLog(@"App logged in");
}

- (void)fbDidNotLogin:(BOOL)cancelled
{
    NSLog(@"App did not login");
}

@end

有关信息:

“entergraph

Facebook Appeck(大部分是 out):

“Facebook

Note: I tried it with only basic settings and also with the iOS Native app settings with a fake iTunes store ID but the same bundle ID from my provisioning profile.

不管怎样,我总是装上“Facebook”,要求授权我,然后,它只是关闭了 screen窗,坐在我的“Facebook”屏幕上,而不是回到我的手上。

同样值得注意的是:我知道,它总是会问,因为我不去检查th子和到期日......这是下一步。

我是否在这里错过了东西? 否则,我会设法使Facebook回到我的身边吗?

EDIT:同样,在偷渡时,我似乎找不到出于某种原因要求开放URL的任何地点。

EDIT #2:在模拟器上运行时,它通过Safari(按预期)装载FB Dialog,然后当我授权时,聋ari人就犯了错误,因为他们试图用URL返回我的手脚:

“simulator

我在Info.plist中知道,自我的第1234567890号合同确立以来,这仍然给我说了很多话。

最佳回答

页: 1

确保在称为“URL 计划”的项目(一个阵列)下采用尿液计划

这一阵列应当包含能够发射你的信号的所有可能的URL计划。

见所附的对《URL计划》作出更好解释的形象

“url

Also, the "URL identifier" should be your bundle identifier: ex. com.mycompany.myapp This should match the identifier you provide on your provisioning profiles

希望这一帮助!

问题回答

All you have to follow these steps

STEP 1:

Facebook开发商身边:

If your app is already submitted then fill iphone/ipad appstore id otherwise leave it empty. facebook developer account app id settings

STEP 2:

接下来是:

Goto Target > Info > URL Types > click plus icon and add the items like this- URL Scheme settings

在我的申请中,有两种选择,即通过脸谱仪进行标识,因此我建立了两种URL型号。 你们可以看到第二位是Facebook URL型环境。 URL 这项计划是您的面像设计书开发账户的面值,开端是fb。 因此,如果您的面值开发商贴上9876543267575645,则URL计划将成为fb9876543267575645

STEP 3:

Next, you have to add a new key in info.plist. So remain in same screen and add FacebookAppID like this screen: info.plist settings

所有这一切都会使你们的 app在成功的故事后回头。

STEP 4:

请在<代码>AppDelegate类别中填写。 在<代码>AppDelegate.m中添加这一方法。

NSString *retURL = [NSString stringWithFormat:@"%@", url];    
if ([retURL rangeOfString:facebookid].location != NSNotFound)
{
    // if your application is coming back from facebook native app.
    return [_facebook handleOpenURL:url];
}
else
{
    // if your app is coming back from google plus oauth.
    return [GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation];
}

在此期间,必须简明扼要和综合facebook>。

@synthesize facebook = _facebook;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    _facebook = [[Facebook alloc] initWithAppId:facebookid];
    // rest of your code is already here......
}

更重要的是。 期间 我正在执行这些步骤,我也进行了太多的研究,以实现这一目标,最后,这里的工作 st脚。 我在两处做了发言。

但是,在我提出第三点时,我从一开始便没有遵循STEP 3和voila.... redirection work! 因此,在你把“Facebook”登录在你身上的时候,没有必要考虑进来。

我陷入另一个问题。 我编辑了Info.plist原始档案,并补充说:

<key>URL Types</key>
<array>
    <dict>
        <key>URL Schemes</key>
        <array>
             <string>fbxxxxxxxxx</string>
        </array>
    </dict>
</array>

由于这些钥匙不是URL型号、URL型计划和URL Identifier,而是使用CFBundleURLTypes 、CFBundleURLSchemes和CFBundleURLIdentifier。 缩略语

确保对X条码中的Info.plist进行选择,右边点点“和”;how头钥匙/价值。

“entergraph

尽管我似乎有同样的问题,但上述答复或关于SO的其他答复都没有为我工作。

然而,当我能够“全面联系”时,它的工作是完美的,因此它可能是上述所有因素的结合,也使这一选择成为可能。





相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...