I am here to implement the Community post search feature that appears when a GET request is sent, where the URL contains the search keywords and other information about the user
No results are found, but links can be opened in the browser
Error message printed in the console first, printed as follows:
Error domain=nsurlerrordomain code=-1002 "Unsupported URL"
I first read some blogs on the internet, but after trying nothing to my problem, I finally went back to the starting point to find, I found that the string I requested contains Chinese characters, the Final solution is to include one of the Chinese characters in the parameter q corresponding text encoding
[text stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]
Recompile, run, OK.
nsdictionary *dic = @{ @ "Q":[text stringbyaddingpercentescapesusingencoding:nsutf8stringencoding], @ "P0":@1, @ "P1": User.userid?user.userid:[uidevice currentDevice].identifierForVendor.UUIDString, @ "P2": @1 , @ "P3":@10, @ "P4":@0 }; [requestmanager requestgetasymethod:@ "Threads" parameters:dic requestsucess:^ (Id object) { nslog (@ "%@", Object ); if ([object[@ "status"] integervalue] == 0 && object[@ "status"]) { if ([object[@ "Threads"][@ "Rows"] isequal:[nsnull null]]) {   [uiview showmessage:@ "Didn't find the topic you wanted"]; return ; } NSArray *arr = (nsarray *) object[@ "Threads"][@ "Rows"]; if (arr.count == 0) { [uiview showmessage:@ "Didn't find the topic you wanted"]; return ; } [ _dataarr removeallobjects]; for (int i=0; i <[(nsarray *) object[@ "Threads"][@ "Rows"] count]; i++) { nsmutablearray *array = [ nsmutablearray array]; LocalLoginArticlesModel *model = [[LocalLoginArticlesModel alloc] initwithdic:object[@ "Threads"][@ "Rows"][i]]; [array addObject:model]; [_dataArr addObject:array]; } _tableview.arr = _dataArr; [_tableView reloaddata]; } } requestfailer:^ ( Nserror *error) { nslog (@ "error"); }];
Read a few blog although did not solve the problem, but the page gave me inspiration, save later with
Http://stackoverflow.com/questions/24102304/nsurlerrordomain-code-1002-downloading-pdf
Nsurlerrordomain code=-1002 "Unsupported URL"