简体   繁体   English

如果设备具有Facebook App,则Facebook API不调用委托(请求)方法

[英]Facebook API not calling delegate(request) methods if device having Facebook App

In my app am using Facebook api and in my device am having Facebook app(FBApp) also. 在我的应用程序中使用Facebook api,在我的设备中也具有Facebook应用程序(FBApp)。 In my app i provided a button to login when we click on button it is opening FBApp login screen and after that it is coming to my app. 在我的应用程序中,当我们单击按钮时,我提供了一个用于登录的按钮,它将打开FBApp登录屏幕,然后它将进入我的应用程序。 Here the following methods are not firing 这里以下方法不触发

-(void)request:(FBRequest *)request didReceiveResponse:(NSURLResponse *)response -(void)request:(FBRequest *)request didLoad:(id)result -(void)请求:(FBRequest *)请求didReceiveResponse:(NSURLResponse *)响应-(void)请求:(FBRequest *)请求didLoad:(id)结果

This is the button action 这是按钮动作

- (IBAction)LoginOrLogout 
{
// If the user is not connected (logged in) then connect.  Otherwise logout.
if (!isConnected)
{
    [messageTextField setHidden:NO];
    [facebook authorize:permissions];
    // Change the lblUser label's message.
    **[lblUser setText:@"Please wait..."];** //struck here only not firing delegate response methods above
}
else 
{
    [facebook logout:self];
    [messageTextField setHidden:YES];
    [lblUser setText:@"Tap on the Login to connect to Facebook"];
}
isConnected = !isConnected;
[self setLoginButtonImage];
}

Without FBApp it is calling delegate methods successfully.How can we solve this. 如果没有FBApp,它将成功调用委托方法。 Any one can help or suggest. 任何人都可以提供帮助或建议。

Actually when you tap on authorize then it will open safari or if there is facebook app on device then it will open facebook app otherwise it will open facebook in safari. 实际上,当您点击授权时,它将打开safari,或者如果设备上有facebook应用,则它将打开facebook应用,否则它将在safari中打开facebook。 If you don't want to open the safari and facebook app then in facebook.m change this statement everywhere where it is calling to NO. 如果您不想打开野生动物园和Facebook应用程序,则在facebook.m中将其更改为“ NO”。

[self authorizeWithFBAppAuth:NO safariAuth:NO];

I was only able to receive those notifications on the AppDelegate class. 我只能在AppDelegate类上收到这些通知。 I tried to create an util class that could be plugged in every project so it could help people using the Facebook API. 我试图创建一个可以在每个项目中插入的util类,以便它可以帮助使用Facebook API的人们。 The problem is that even tho I set the delegate to my util class, the delegate's methods were never called. 问题在于,即使我将委托设置为util类,也从未调用过委托的方法。 Try to put then on the AppDelegate.. 然后尝试放在AppDelegate上。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM