MKNetWorkKit打印URL
-(void)initNewUrl:(NSString *)urlString param:(NSMutableDictionary *)_paramDic{
//拼接参数至URL
NSMutableString *paramsStr = [[NSMutableString alloc] initWithString@“”];
if(_paramDic!=nil && [_paramDic cout] >0)
{
NSEnumerator * enumerator = [_paramDic keyEnumerator];
id key;
int c = 0;
while(key = [enumerator nextObject]){
if(c !=0){
[paramStr appendString:@“&”];
}
[paramStr appendFormat:@“%@=%@”,key,[_paramDic objectForKey:key]];
c++;
}
}
NSMutableString *newUrl = [[NSMutableString alloc] initWithString:urlString];
if(paramsStr != nil && [paramsStr length] >0){
NSRange range;
range = [newUrl rangOfString:@“?”];
if(range.length!=0){
[newUrl appendFormat:@“&%@”,paramsStr];
}else{
[newUrl appendFormat:@“?%@”,paramsStr];
}
}
NSLog(@“newUrl=%@”,newUrl);
}
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。