美文网首页
web 调去app,传参数,将传过来的url 转成字典

web 调去app,传参数,将传过来的url 转成字典

作者: dxin_101 | 来源:发表于2022-07-15 14:13 被阅读0次

-(NSDictionary *) parameterWithURL:(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;

}

相关文章

网友评论

      本文标题:web 调去app,传参数,将传过来的url 转成字典

      本文链接:https://www.haomeiwen.com/subject/kxzqirtx.html