开发者

Newest FBConnect with Objective-C Application

I am using newest SDK for facebook for iphone application. My Problem is that i could not maintain the session through out the application. everytime i have to make new facebook variable and initilize it to app id to work. But that leads to multiple session And the if i am logged in even then it show "LOGIN" in the next tab. Here is scenario

1) Home Tab, i logged in

2) Second Tab, the button for facebook shows that i am not login, I have to relogin.

and so on with the third tab.

Is there a way that i keep one session in all the application?

Can you please guide me in this p开发者_开发知识库roblem

[_facebook isSessionValid];

it returns me that the Session is not valid, Can you please help me out in this regard. Please guide me.

permissions =  [[NSArray arrayWithObjects:@"read_stream",@"read_mailbox", @"offline_access",@"read_friendlists", @"friends_location", @"friends_birthday",@"friends_about_me",@"friends_hometown",@"friends_relationships",@"friends_relationship_details",nil] retain];

facebook = [[Facebook alloc] initWithAppId:appId]; [facebook authorize:permissions delegate:self];

I put this code in App delegate, and assigned it into new view controller like this

fb = [[Facebook alloc] init];
fb = appdel.facebook;

But it says Try again, error occured (corrected)

Thanks


You shouldn't be using a new facebook variable with every page. You need to have a global one stored in a place that's accessible by the different views/classes. You can do this easily by having the facebook variable be stored in the app delegate. The classes can reference this facebook object like so:

((YourAppDelegate *)[UIApplication sharedApplication].delegate).facebook

(assuming that you have a property called facebook in your app delegate)

Hope this helps!


I struggled with FBConnect for a good few days and did not find the documentation at github.com was helping me. Each time I tried to upload a test photo from my iPad app to my Facebook page I got an error_code=101 Invalid API Key.

I fixed this by following the very clear instructions at:

http://developers.facebook.com/docs/guides/mobile/

which takes you step by step through the process.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜