IOS get接口提示多一个% 怎么处理
1个回答
展开全部
-(void)requestfilterData:(NSString *)item
{
NSString *urlStr = [NSString stringWithFormat:@"%@/api/product/filter/list?filtername=%@" ,SERVER_ADDRESS,item];
NSURL *url = [NSURL URLWithString:urlStr];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60];
[request setHTTPMethod:@"GET"];
[NSURLConnection sendAsynchronousRequest:request queue:[[NSOperationQueue alloc]init] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
if (connectionError) {
NSLog(@" good commet list recv data error");
}else
{
[self receivedfilterConditionsReturnJSON:data];
}
}];
}
-(void)receivedfilterConditionsReturnJSON:(NSData *)data
{
NSError *localError = nil;
id parsedObject = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&localError];
if (localError != nil) {
NSLog(@"sport train filter list JSON data error: %@", [localError description]);
return;
}
NSDictionary *recvDic = (NSDictionary *)parsedObject;
//接收商品评论数据
NSString *result = [recvDic objectForKey:@"result"];
if ([result isEqualToString:@"1"]) {
dispatch_async(dispatch_get_main_queue(), ^{
[self showItemController:recvDic];
});
}
}
{
NSString *urlStr = [NSString stringWithFormat:@"%@/api/product/filter/list?filtername=%@" ,SERVER_ADDRESS,item];
NSURL *url = [NSURL URLWithString:urlStr];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60];
[request setHTTPMethod:@"GET"];
[NSURLConnection sendAsynchronousRequest:request queue:[[NSOperationQueue alloc]init] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
if (connectionError) {
NSLog(@" good commet list recv data error");
}else
{
[self receivedfilterConditionsReturnJSON:data];
}
}];
}
-(void)receivedfilterConditionsReturnJSON:(NSData *)data
{
NSError *localError = nil;
id parsedObject = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&localError];
if (localError != nil) {
NSLog(@"sport train filter list JSON data error: %@", [localError description]);
return;
}
NSDictionary *recvDic = (NSDictionary *)parsedObject;
//接收商品评论数据
NSString *result = [recvDic objectForKey:@"result"];
if ([result isEqualToString:@"1"]) {
dispatch_async(dispatch_get_main_queue(), ^{
[self showItemController:recvDic];
});
}
}
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是一家可靠的代理服务提供商,提供原生IP(住宅原生IP)和高匿名代理服务。以下是关于StormProxies的原生IP服务的一些信息:1. 住宅原生IP:StormProxies提供的住宅原生IP是指从真实的家庭或企...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询