Facebook iOS SDK没有返回到我的应用程序 [英] Facebook iOS SDK not returning to my app

查看:90
本文介绍了Facebook iOS SDK没有返回到我的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将新的oAuth2 facebook SDK实现到我的应用程序中,但是不能在我的生活中理解我如何在登录/验证后重新回到我的应用程序。

I'm trying to implement the new oAuth2 facebook SDK into my app but can't for the life of me understand how I'm supposed to get back to my app once logged in/authenticated.

我的目标是在用户墙上发布消息。

My goal is to post a message on the users wall.

我目前正在启动登录过程:

I am currently starting the login procedure with this:

-(void)tryFBlogin {

NSString *appId = @"113142482******";

NSArray *permissions =  [[NSArray arrayWithObjects:@"publish_stream",nil] retain];

TheAppDelegate *theAppDelegate = (TheAppDelegate *)[[UIApplication sharedApplication]delegate];

//Asking for permission
theAppDelegate = (TheAppDelegate *)[[UIApplication sharedApplication] delegate];
theAppDelegate.facebook = [[Facebook alloc] initWithAppId:appId andDelegate:self];
Facebook *fb = [theAppDelegate facebook];
[fb  authorize:permissions];

}

这是打开Safari浏览器。如果我已经登录,并且授权应用程序的消息会告诉我,我有一个OKay按钮可以按。

which is opening a safari browser. If I'm already logged in and have the app authorized a message will tell me so and I have an OKay button to press.

当我按OKay按钮我得到一个警报说safari无法打开页面。我确认警报,并留下一个空白的徒步旅行窗口。

When I press the OKay button I get an alert saying safari cannot open the page. I confirm the alert and am left looking at a blank safari window.

如果我已经登出了Facebook,我将会收到我填写的登录画面,然后与上述相同。

If I'm logged out of facebook I am presented with the login screen which I fill in and am then presented with the same as above.

我知道我还没有在任何地方实现发布命令,因为我不知道在哪里/应该实现这个。

I understand that I haven't implemented the publish command anywhere yet as I don't know where/when this should be implemented.

我有这个委托方法,但这似乎永远不会被调用

I do have this delegate method in place but this seems to never get called

- (void)fbDidLogin {

    NSLog(@"fbDidLogin");
}

这是我等待放置的代码:

This is the code I have waiting to place somewhere:

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAppId, @"113142482******",
facebookUrl, @"link",
@"http://www.domain.com", @"picture",
@"My Message", @"name",
@"Caption text!", @"caption",
@"Message text.",  @"message",
nil];

[facebook dialog:@"feed" andParams:params andDelegate:self];

我的应用程序主要还有以下方法AppDelegate:

I also have the following methods in my apps main AppDelegate:

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

任何帮助/建议将非常感谢。

Any help/suggestions would be very much appreciated.

谢谢

标记

推荐答案

我有同样的问题。只是为了澄清一些其他答案,这里是我如何解决我的iPhone应用程序在Xcode 4.2中的问题:

I had this same problem. Just to clarify some of the other answers, here's how I fixed the issue for my iPhone app in Xcode 4.2:

.plist file
    "URL types"
    "Item 0"
        "URL Schemes"
        "Item 0"
            "fb21593853845xxxx"

这篇关于Facebook iOS SDK没有返回到我的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆