How to send Asynchronous URL Request?

后端 未结 5 2011
孤独总比滥情好
孤独总比滥情好 2020-11-27 17:30

I would like to know how do I get a return value 1 or 0 only.... back from an URL request asynchronously.

currently I do it in this way:

NSString *UT         


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-27 17:46

    Use NSURLConnection and make your request. Then you may start synchronous or asynchronous connection with NSURLConnection's methods :

    Loading Data Synchronously

    + sendSynchronousRequest:returningResponse:error:
    

    Loading Data Asynchronously

    + connectionWithRequest:delegate:
    – initWithRequest:delegate:
    – initWithRequest:delegate:startImmediately:
    – start
    

    Check the NSURLConnection class in Apple Developer API Reference.

提交回复
热议问题