zoukankan      html  css  js  c++  java
  • IOS AFNETWORKING POST

    IOS AFNETWORKING POST 请求

            #pragma mark post 请求
            // 获取 url 路劲,不带参数
            NSString *requestUrl = [[url componentsSeparatedByString:@"?"] objectAtIndex:0];
            
            // url参数截取
            NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithCapacity:10];
            NSArray *parameArray = [[[url componentsSeparatedByString:@"?"] objectAtIndex:1] componentsSeparatedByString:@"&"];
            
            for (int i = 0; i < [parameArray count]; i++) {
                
                NSString *key = [[[parameArray objectAtIndex:i] componentsSeparatedByString:@"="] objectAtIndex:0];
                NSString *value = [[[parameArray objectAtIndex:i] componentsSeparatedByString:@"="] objectAtIndex:1];
                
                [dic setObject:value forKey:key];
            }
            
            AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
            
            [manager POST:requestUrl parameters:dic success:^(AFHTTPRequestOperation *operation, id responseObject) {
                
                NSString *html = operation.responseString;
                
                NSString *js = [NSString stringWithFormat:@"%@(%@);",method,html];
                [self.webView stringByEvaluatingJavaScriptFromString:js];
                
            } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
                
                
                NSLog(@"AFHTTPRequestOperationManager:发生错误!%@",error);
            }];
  • 相关阅读:
    php中防盗链使用.htaccess
    使用Apache的.htaccess就可以防盗链
    左连接和右链接的区别?
    大量查询SQL语句 实例
    java项目打包
    java小项目
    哈夫曼树
    广义表
    树和森林的遍历
    根据前序中序,中序后序建立二叉树
  • 原文地址:https://www.cnblogs.com/duke-cui/p/4798709.html
Copyright © 2011-2022 走看看