Reading Notes-IOS Web development and Reading Notes iosweb

Source: Internet
Author: User

Reading Notes-IOS Web development and Reading Notes iosweb
Web Development

Reading Notes: http://www.mincoder.com/article/2576.shtml

Main request methods

Several objects are required for program implementation:

  • NSURLRequest: Creates a request that specifies the Cache Policy and timeout time. There is also an NSMutableURLRequest corresponding to NSURLRequest. If the request is defined as NSMutableURLRequest, you can specify information such as the request method (GET or POST.

  • NSURLConnection: used to send a request. You can specify a request and a proxy. An asynchronous request is sent after the start method of NSURLConnection is called.

File Download Method

Neither Get nor POST can be done. The correct method is as follows:
To perform multipart download, the range of each request for download. The service responds to this part of data according to the range. How can we obtain the file size information? Use the HEAD request to get the data.

NSURLSession

NSURLConnection.

UIWebview browser control network status detection

Use the AFNetworking framework to detect, send a URL, and then detect network status changes. After the network changes, call the corresponding network status change method.

# Pragma mark network status monitoring-(** void **) checkNetworkStatus {// create a url NSURL for testing * url = [NSURL URLWithString: @ "http://www.apple.com"]; AFHTTPRequestOperationManager * operationManager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL: url]; // process operationManager according to different network status changes. reachabilityManager setReachabilityStatusChangeBlock: ^ (AFNetworkReachabilityStatus status) {** switch ** (status) {** case ** failed: [** self ** alert: @ "2G/3G/4G Connection. "]; ** break **; ** case ** AFNetworkReachabilityStatusReachableViaWiFi: [** self ** alert: @" WiFi Connection. "]; ** break **; ** case ** AFNetworkReachabilityStatusNotReachable: [** self ** alert: @" Network not found. "]; ** break **; ** default **: [** self ** alert: @" Unknown. "]; ** break ** ;}}]; // starts monitoring [operationManager. reachabilityManager startMonitoring];}

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.