IOS 8:rest Programming several considerations

Source: Internet
Author: User

There are a few key points to note when writing iOS clients using the rest service:

  • Never use synchronous network calls. even in a background thread, the synchronization call does not report progress. Another reason is that if you want to cancel a synchronization request for a background thread, you can only end this thread, which is also not a good idea. In addition, there is no control over the number of network requests in the application, which is critical to the performance of the application.
  • Try not to use Nsthread or GCD-based threads for network operations (unless the project is very small and there are only a few API calls).
  • use a nsoperationqueue-based thread. with Nsoperationqueue, you can control the queue length and the number of concurrent network operations very well. GCD-based threads cannot be canceled after the block has been dispatched.

Reference documents:

Rob Napier is waiting, the American Regiment mobile translation. iOS programming combat. BEIJING, People's post and telecommunications press. Page 161

IOS 8:rest Programming several considerations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.