user1843783
user1843783

Reputation: 41

Facebook startForPostWithGraphPath completionHandler block not called if run from background thread

I am adding error handling to my code that post a message to Facebook, but am hitting an odd behavior that I am trying to understand. In my completion handler for FB's startForPostWithGraphPath I check to see if there is an error, if there is then I wait a few seconds before trying to post again. The issue I am hitting is that when I try to call the method to post this message a second time, I run it on the main thread it works fine. If I try to run it on the background thread it fails silently. As in the completion handler is never called the second time.

works

dispatch_after(popTime, dispatch_get_main_queue(),
               ^(void){
                    [MYSocial shareToOpenGraph:poll];
               });

Fails

dispatch_after(popTime, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
               ^(void){
                 [MYSocial shareToOpenGraph:poll];
               });

I am curious if anyone else has any experience with FB request methods needing to be called on the main thread. It seems to me that calling retry logic on a background thread is the correct behavior, but obviously is not working for some reason.

Upvotes: 1

Views: 454

Answers (1)

smoothlandon
smoothlandon

Reputation: 78

i can confirm that the request works on the main thread & fails on the background thread in my application.

Upvotes: 1

Related Questions