iOS4 Implementation of -[NSURLConnection sendAsynchronousRequest:queue:completionHandler:]?

前端 未结 3 467
孤街浪徒
孤街浪徒 2021-01-03 11:40

How can I implement -[NSURLConnection sendAsynchronousRequest:queue:completionHandler:] for iOS < 5?

#if __IPHONE_OS_VERSION_MIN_REQUIRED <         


        
3条回答
  •  借酒劲吻你
    2021-01-03 12:04

    I would go with an already built framework like ASIHTTPRequest (No longer being developed, but still very good) or RestKit (I've never used it before but heard it's decent). These will give you the same functionality (asyncrhonous http requests) across different versions of the OS.

    ifdefs aren't the way to go since they're done at compile time and you won't be compiling separate versions of the app for each platform.

    You could probably do some shenanigans at runtime to get it to work but it seems like more trouble than it's worth.

提交回复
热议问题