ios - 预期方法调用的参数太多 1 有 3

标签 ios json compiler-errors arguments

请帮我找出错误,我的代码是

NSURL *url = [NSURL URLWithString: @"http://www.xxxx.com/xxxx_webservice/login.php?user=%@&pass=%@&format=json",Username,Password];

Screenshot

最佳答案

这样做。首先制作一个正确的 URL 字符串,然后对其进行编码,最后将其制作成 NSURL。确保传递正确的参数集。

NSString *link = [NSString stringWithFormat:@"http://www.example.com/xx_webservice/login.php?user=%@&pass=%@&format=json",Username,Password];
NSString *encdLink = [link stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url=[NSURL URLWithString:encdLink];

关于ios - 预期方法调用的参数太多 1 有 3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24201310/

相关文章:

ios - Today Extension 的 NSUserDefaults 不保存数据,iOS swift。不知道我在这里做错了什么

python - 如何将复杂的json字符串反序列化为python对象?

json - $ .get使用google API检索YouTube视频,在IE中不返回任何内容

c++ - 在英特尔编译器的特定位置禁用警告

ios - 在 Swift 的文档选择器 View Controller 中显示云存储选项

ios - ReactiveSwift 中运算符 '<~' 的使用不明确

ios - NSDictionary - 从返回 JSON 服务中解析项目

json - Swift 3 - 返回 null 的 SwiftyJSON 字符串

c++ - 使用 std::map 时只读成员的错误递减

java - 实参 Date 无法通过方法调用转换转换为 int