I'm using FBConnect sdk in order to publish posts to a user's profile via my application. I'm having a number of problems with this:

When the relevant code runs for the first time on the device, the user is re-directed, as wanted, to the facebook app/website, which asks him to authorize it. if the user authorizes it, it returns back to the application, which pops a "Connect to facebook" view controller which asks the user to log in. this is weird, as the user is already logged in, otherwise how could he authorize the app? but I guess this may be ok, as he hadn't logged in through the app yet. after he logs in, it does nothing. only the second time the code gets run, after he authorized the app, the user gets the posting dialog.

If the user hadn't authorized the app, when it comes back to my app after the authorization dialog, it asks the user to login ( just as if he authorized ), and does nothing after he had logged in. only the second time the code gets ran, the authorization dialog opens, with the optinos "Authorize" & "Leave App", instead of "Authorize" & "Don't authorize" / "Allow" & "Don't Allow".

In addition, if the user has deleted his authorization via his account's settings on facebook, instead of just asking him to re-authorize it, a facebook dialog pops ( instead of the post/authorization dialog ), saying: "An error occurred. Please try again later." Trying later doesn't help. it will pop always, even if u restart the app. the only way to make it go away is to re-install the app, which will cause it to re-pop the authoriziation dialog.

So here's what I want to achieve:

After the user authorizes the app, he wouldn't have to log in again.

After the user authorizes the app, the posting dialog will pop immedietly, without him having to re-run the code ( which is triggered, btw, with a button ).

If the user un-authorizes the app, he will be prompted again with the authorization dialog, instead of the error dialog

If he refused the authorization, I will call a function that displays an error/etc.

Is it possible that I'm missing a couple of delegate functions on MyViewController? Because I see for some reason I've marked it as implementing the FBDialogDelegate protocol, although he doesn't implement any function from there.

I'd be really glad if you guys would help me, as this is extremely frustrating for me. I couldn't find nothing about this on the internet, and I feel like im drowning in here.

It's probably not the answer to your question, but it seems to me one problem you might have is the Facebook instance that's recreated on every share. From the documentation it seems the Facebook instance is generally added to the AppDelegate and never reassigned when the app is running. Perhaps check out this code I wrote for a project I'm working on, it might be easier to solve your issues (it's not perfect yet, but seems to work fine as far as sharing is concerned): stackoverflow.com/questions/7085162/…
–
Wolfgang SchreursAug 20 '11 at 8:27

6 Answers
6

The offline_access key here will keep your auth token alive forever (or, more specifically, until the user manually de-authorizes your application in their application settings in their Facebook account settings). Also, set your active VC as the delegate (more on that later).

Sounds like you're experiencing the same issue described in this Facebook Platform Developer forum post. I'm encountering the same problem, but on the web. Only one response was given from Facebook in that thread, and it's wrong information.

Facebook has the worst developer docs and developer support ever, I wouldn't hold my breath waiting on a solution.

I'm getting this error from ShareKit itself (this page was one of the first hits I got on Google, trying to debug ShareKit). ShareKit is terrible - the sum total of the docs for Facebook say "there is no setup for Facebook", which is patently untrue. I would recommend avoiding it - I'm about to switch back to the FB iOS SDK because ShareKit is so appallingly bad.
–
AdamSep 23 '11 at 13:02

I was having the exact same issue, and used Ben Mosher's response above, but I also decided to create a simple singleton class for the Facebook object, so that in my AppDelegate I can handle the following function properly:

I had similar but not the same problem: message "An error occurred. Please try again later." was shown always.

The problem was with not properly configured App ID - it was provided by customer (so I'm not sure what exactly was wrong); everything works properly since I replaced it with my own test App ID (from previous app).