SKProductsRequest - how to handle timeouts / connection errors? SKProductsRequest - how to handle timeouts / connection errors? objective-c objective-c

SKProductsRequest - how to handle timeouts / connection errors?


I run this in my project for whenever an SKRequest fails (which includes SKProductRequest):

- (void)request:(SKRequest *)request didFailWithError:(NSError *)error{     alert = [[UIAlertView alloc] initWithTitle:@"In-App Store unavailable" message:@"The In-App Store is currently unavailable, please try again later." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];     [alert show];}

Works a treat. Of course you can place anything inside the brackets to replace my alert, but this works well for the user.

Hope this is of use to you.

Note: This is in SKRequestDelegate not in SKProductsRequestDelegate, which is slightly confusing. The SKRequestDelegate is used for purchasing and for product requests. The delegate set using request.delegate can implement methods for both.


I don't believe you can do anything other than wait an arbitrary amount of time. In some of my apps I wait 30 seconds (while showing a modal activity view) and then bail out with a generic error alert. The problem is, in reality 30 seconds is beyond most users' attention span for such issues, but if you make it short enough to be useful (say 15 seconds), you might actually bail too early.

I don't think there is a better option ... but I'm willing to learn otherwise!