UI网络编程:get和post

来源:互联网 发布:淘宝上买东西如何退货 编辑:程序博客网 时间:2024/06/05 16:35
    GCD界面刷新:       dispatch_async(dispatch_get_main_queue(),block);
http请求方式分为:
get:索取数据。只有请求头
post:提交数据。包含请求头和请求体
UI界面得渲染育刷新在主线程中执行,主线程不流畅会导致卡顿。

 

   //1.

    NSURL*url = [NSURLURLWithString:@"http://piao.163.com/m/cinema/list.html?app_id=1&mobileType=iPhone&ver=2.6&channel=appstore&deviceId=9E89CB6D-A62F-438C-8010-19278D46A8A6&apiVer=6&city=110000"];

   

   //2,请求对象需要设置:URL,请求方式, 请求体, 请求头

   NSMutableURLRequest *request = [[NSMutableURLRequest alloc]init];//[NSURLRequest requestWithURL:url];

   request.URL = url;

   request.HTTPMethod = @"GET";

   

//   [request setAllHTTPHeaderFields:

0 0
原创粉丝点击