您的位置:首页 > 产品设计 > UI/UE

不受支持的URL Statue Code 1002

2016-03-23 14:31 483 查看
1. 错误提示:

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 编码的文档
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: