I was wondering how to differentiate between the user tapping submit or skip in the inline post-to-stream FBDialog. Anyone know what to test for?
I am using the latest iOS Facebook Connect in a iOS 4.2 environment.
/**
* Called when a UIServer Dialog successfully return.
*/
- (void)dialogDidComplete:(FBDialog *)dialog {
if user tapped submit and post was successful
alert user of successful post
if user tapped "skip" (cancel equivalent)
do not display alert
}
Hello I just follow link by @Oh Danny Boy and I found this solution
from this thread : http://forum.developers.facebook.net/viewtopic.php?pid=303257#p303257 Fixed this by adding the following to webViewDidFinishLoad: in FBDialog.m
This makes the cancel button correctly call "fbconnect://cancel" rather than "fbconnect://success".
Its works fine:
But There is one more issue If Facebook Change html then this code will no longer work. My solution to this problem is that :
Instead of putting JavaScript statically just get it from server at regular interval or similer mechanism
so in future we can change this javascript instead of updating whole application.
I hope in future this bug will be solved http://bugs.developers.facebook.net/show_bug.cgi?id=5958
I did some experimentation and it seems that when the post is submitted you will get two callbacks: dialogCompleteWithUrl and then dialogDidComplete. When the post is skipped, you will only receive the dialogDidComplete callback.
You could trigger your success alert on the dialogCompleteWithUrl callback. If you wanted to wait until you received the dialogDidComplete callback you could save some state during the dialogCompleteWithUrl callback and then based on that state fire your alert in dialogDidComplete.
During my test the url I received during dialogCompleteWithUrl was of the form "fbconnect://success/?post_id=1627754863_182914058401072"
So if need be you could even peek at this value to further confirm your success, although I expect that if the post really did fail (as opposed to a skip) you will get one of the fail callbacks instead.
As Fede and kennbrodhagen said, this looks like the easiest way (until Facebook fixes this bug):
My understanding is that
would be called for the skip.
I haven't tested this theory though.
Edit: I tested it now, and my theory is wrong. The code looks like the dialog should call
on your delegate, but it practise it seems to not do so, as the web page is returning fbconnect://success for a press of the "skip" button. This sounds like a bug to me.