Reputation: 289
hey guys does the ios facebook sdk asynchronous request delegate allow developer to specify some sort of timeoutInterval value? i know that the nsURLRequest has a timeoutInterval value that u can set.
Thanks for your help.
scenario: i make an async request call. the connection dies after the request call goes out and before the response comes back. currently, i have no way of detecting this. what i want is: i call line number 2. after 10 sec, no response comes back, line 5 would get execute. Or something along the line that there were an error.
1 - // async request call
2 - [facebook requestWithGraphPath:@"me/home" addParams:nil andDelegate:self];
3 - // delegate
4 - - (void) request :(FBRequest *)request didLoad:(id)result {}
5 - - (void) request :(FBRequest *)request didFailWithError :(NSError *)error {}
Upvotes: 1
Views: 2724
Reputation: 298
FBRequest.m applies it's timeoutInterval to NSMutableURLRequest, which ignores/overrides anything under 240 seconds. If your interested, read more about that here...
iPhone SDK: URL request not timing out
...otherwise it basically means the kTimeoutInterval in FBRequest.m is ignored if set to < 240, so don't bother with it.
I've just gone through this issue myself, I ended up using an NSTimer that will cancel the pending FBRequest's connection on timeout. see details here..
Facebook API - How to cancel Graph Request
Upvotes: 0
Reputation: 3036
see Facebook ios SDK, FBRequest.m file at the beginning:
static const NSTimeInterval kTimeoutInterval = 180.0;
then it is used by a connect method. You can change it or patch the SDK so it could be set externally.
hope this helps
Upvotes: 5