- (NSDictionary *)getUrlParameterWithUrl:(NSURL *)url {
NSMutableDictionary *parm = [[NSMutableDictionary alloc]init];
//传入url创建url组件类
NSURLComponents *urlComponents = [[NSURLComponents alloc] initWithString:url.absoluteString];
//回调遍历所有参数,添加入字典
[urlComponents.queryItems enumerateObjectsUsingBlock:^(NSURLQueryItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
[parm setObject:obj.value forKey:obj.name];
}];
return parm;
}
https://www.jianshu.com/p/93cc6dae2d5e
https://www.jianshu.com/p/71f3289b3883
网友评论