不受支持的URL Statue Code 1002
2016-03-23 14:31
483 查看
1. 错误提示:
[/code]
URL 不能包含 ASCII 字符集中, 不是必须这样的字符进行转义的字符。
使用
NSString *string = @"http://192.168.0.75:8089/api/PublishGoods/GetPublishGood?page=1&pageSize=9";
NSString *urlString = [string stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
请参阅字符设置为 URL 编码的文档
Error description=Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo=0x78f97920 {NSUnderlyingError=0x79f78bd0 "unsupported URL", NSLocalizedDescription=unsupported URL}
[/code]
2. 解决办法:
URL 不能包含 ASCII 字符集中, 不是必须这样的字符进行转义的字符。
使用
stringByAddingPercentEncodingWithAllowedCharacters字符集
URLQueryAllowedCharacterSet
NSString *string = @"http://192.168.0.75:8089/api/PublishGoods/GetPublishGood?page=1&pageSize=9";
NSString *urlString = [string stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
请参阅字符设置为 URL 编码的文档
相关文章推荐
- csdn git code 不能git clone git@code.csdn.net:yefengxuelang/testcsdn.git
- LeetCode#334. Increasing Triplet Subsequence
- UITableView 取得点击的cell
- UESTC - 1271 Search gold (DP)
- RequireJS禁止缓存
- 信号发送(sigqueue)和接收(sigaction)
- iOS开发UI篇—CAlayer(自定义layer)
- 关于UITableView — cell上点击按钮变换
- 演练:从头开始创建 MSBuild 项目文件
- NSNumber和NSValue
- MSDN中对MSBuild的解释页
- EasyUI前端框架控件案例
- 16其他UI内容
- 15.UIDynamic 物理引擎
- MSBuild入门
- 开发UI控件时遇到的问题(类似于苹果Assistive Touch)
- [转]MSBuild的简单介绍与使用
- ios的手势操作之UIGestureRecognizer浅析
- UIView上添加了一个按钮和一个单击手势的事件相应,互相不影响的处理方法。。
- juery给所有ID属性相同的div绑定一个事件