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

-(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 转成字典)