3

As you know, you can display some facebook views to make some operations, like app requests, post etc. There is a delegate to manage the callbacks like : dialogDidComplete:, dialogDidNotComplete:. The view is like that : enter image description here

But there is not differentiation between the cancel and share button. You will have the same callback in dialogDidComplete:. The only way to manage a cancelation is the little cross in the corner. In my case I would like to do some operations if the user pressed share and not when he pressed Cancel. The private social network Path manage this case and I'm wondering how ?

Do you guys have some ideas ?

Matthieu Lucas
  • 817
  • 1
  • 9
  • 15
  • [This](http://stackoverflow.com/questions/4958912/facebook-api-how-to-cancel-graph-request) might be a similar question. See Wayne Liu's answer. I hope it helps. – jhoanna Aug 31 '12 at 01:12

1 Answers1

6

If I am not wrong:

  • if you press Share you get a requestID back as part of the returned URL

  • if you press Cancel you are returned into dialogDidComplete but it does not return a requestID back as part of the returned URL.

Code:

- (void)dialogCompleteWithUrl:(NSURL *)url {
     if (![url query]) {
         NSLog(@"User canceled dialog or there was an error");
         return;
     }
  }
Glenn
  • 8,932
  • 2
  • 41
  • 54
  • Probably in the sharing case, but there is nothing like that for an app request.. – Matthieu Lucas Aug 31 '12 at 17:56
  • I haven't tried. But you can use the Hackbook sample and add a NSLog to the URL and see to it. This seems more like an implementation issue than a bug on our side. Thanks! – Shireesh Asthana Aug 31 '12 at 18:01
  • Thanks for your answers, I found the solution in the hackbook sample you mentioned. It's strange that the cancel callback is not made in `dialogDidNotCompleteWithUrl:`, `dialogDidNotComplete:` or `dialog:(FBDialog*)dialog didFailWithError:` . – Matthieu Lucas Sep 01 '12 at 00:30
  • I am also relying on the [url query], it is sad that Facebook did not use the dialogDidNotComplete: or dialog:didFailWithError: as the name implied... for success, the url looks something like: fbconnect://success?request=298855633579176&to%5B0%5D=100003013638786 for failure, the url is just: fbconnect://success sadly, it also contain success and not failure in the data – Zennichimaro Apr 18 '13 at 06:36