I use Facebook dialog to post on the wall in such way
[facebook dialog:@"feed" andParams:params andDelegate:self];
If user was not logged in before dialog, login window is appeared in dialog. That's OK,but when user press Log in dialog is dismissed and user must to call dialog again,and after all post my message on his wall. That's pretty weird to force user call dialog twice,so can anyone help me with this problem?
The easiest way to fix this is to store your params
in an ivar. Then when FBConnect calls your delegate with fbDidLogin
then you can automatically re-issue the dialog:andParams:andDelegate
call.
The longer and more correct solution, is that you need to separate out the authorisation and posting steps. You can store the fb.accessToken
and expiry date in NSUserDefaults, and then recall them the first time you try to access FBConnect. If the expiry date has passed, then you make the call to authorize:delegate
to get a new access key. Once the fbLogin is complete, then you post the dialog to the user to continue.
Alternatively, you can not reinvent the wheel, and check out ShareKit http://getsharekit.com/ for a more complete solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With