zoukankan      html  css  js  c++  java
  • [NSURL URLWithString:] 返回nil

    具体问题原因是url中输入的有中文,那么这个就看作非法的字符无法识别。这种的必须使用post方式来发送消息。具体为:

                tmp = mainurl;
                [parameters appendString:key];
                [parameters appendString:value];

    NSURL * downloadUrl = [NSURL URLWithString:self.strURL];
            NSMutableURLRequest *requestL = [NSMutableURLRequest requestWithURL:downloadUrl
                                                                    cachePolicy:NSURLRequestReloadIgnoringCacheData
                                                                timeoutInterval:60.0];
            [requestL setHTTPMethod:@"POST"];
            NSString *postString = parameters;
            [requestL setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
            NSLog(@"the post body is %@",[NSString stringWithFormat:@"%@", postString]);
            


  • 相关阅读:
    pyhanlp 实体命名识别
    NABCD需求分析
    源代码
    遇到的问题和解决方法
    运行及总结
    测试与调试
    读《一个程序猿的生命周期》和《人,绩效和职业道德》有感
    面向对象程序设计
    设计类图
    SRS文档
  • 原文地址:https://www.cnblogs.com/lisa090818/p/3912832.html
Copyright © 2011-2022 走看看