IOS - best way to queue requests to be sent when connection is reestablished

后端 未结 1 1212
花落未央
花落未央 2021-01-25 07:40

in my IOS application I have an in-app purchase in my app and I need to send receipt to my web service to assign premium content to a user account. I need this to be reliable ev

1条回答
  •  北海茫月
    2021-01-25 08:33

    I would definitely recommend AFNetworking, a very well-made networking library which wraps NSURLConnection.

    In order to use it for your purpose you need to take advantage of the reachability build-in features of AFHTTPClient as suggested in this other answer.

    Basically you can execute and arbitrary block whenever the reachability status of the network changes using the setReachabilityStatusChangeBlock: method of AFHTTPClient.

    Just remember to link and import the SystemConfiguration framework, otherwise it won't work.

    0 讨论(0)
提交回复
热议问题