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];}