0
美好的一天, 我正在使用ASIHTTPRequest,並且我在請求中遇到了西里爾文字母的問題。ASIHTTPRequest和西里爾文字母
我有這樣的要求:
self.getUsersFromSearchRequest = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@&text=%@&count=20", SEARCH_FOR_USER, searchBar.text]]];
[self.getUsersFromSearchRequest setDelegate:self];
[self.getUsersFromSearchRequest startAsynchronous];
在此之後我有requestFinished:和requestFailed:方法:
- (void)requestFinished:(ASIHTTPRequest *)request {
self.dictionary = [NSJSONSerialization JSONObjectWithData:[request responseData] options:NSJSONWritingPrettyPrinted error:nil];
if([request isEqual:self.getUsersFromSearchRequest]) {
if ([[self.dictionary objectForKey:@"response"] isKindOfClass:[NSArray class]]) {
self.resultSearchUser = [self.dictionary objectForKey:@"response"];
[self.searchDisplayController.searchResultsTableView reloadData];
}
self.searchResultsTable.hidden = NO;
[MBProgressHUD hideHUDForView:self.view animated:YES];
}
}
- (void)requestFailed:(ASIHTTPRequest *)request {
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:NSLocalizedString(@"Internet Connection Error Alert Title", @"This is the Internet Connection Error Alert Title") message:NSLocalizedString(@"Internet Connection Error Alert Message Text", @"This is the Internet Connection Error Alert Message Text") delegate:nil cancelButtonTitle:NSLocalizedString(@"Internet Connection Error Alert Cancel Button Title", @"This is the Internet Connection Error Alert Cancel Button Title") otherButtonTitles:nil];
[alertView show];
}
當我輸入拉丁字符到搜索文本字段,一切進展良好,但是當我輸入西裏爾字母後,我馬上輸入requestFailed:。哪裏不對?
在此先感謝!