【发布时间】:2013-02-11 21:31:48
【问题描述】:
我正在该应用程序中开发一个应用程序,我需要在 NSURL 中一次传递多个参数 我的代码是
responseData = [[NSMutableData data] retain];
ArrData = [NSMutableArray array];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://rate-exchange.appspot.com/currency?from=%@&to=%@&q=%@",strfrom,strto,strgo]];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
//NSURLRequest *request1 = [NSURLRequest requestWithURL:
//[NSURL URLWithString:@"http://rate-exchange.appspot.com/currency?from=%@&to=%@&q=1",strfrom,strto]];
上面的代码我需要动态传递多个参数。可能吗 ? 如果是,那怎么办? 谢谢和问候
【问题讨论】:
-
尝试在添加到 URL 之前创建一个单独的字符串,例如
NSSString *str=[NSString stringWithFormat:@"http://rate-exchange.appspot.com/currency?from=%@&to=%@&q=%@",strfrom,strto,strgo],然后将此 str 添加到 URL -
首先将所有参数传递给NSString,然后将最终字符串分配给NSURL。
-
我无法完全理解您的问题。您的问题中仍然传递了多个参数
-
现在有什么问题?
-
尝试使用 NSMutableString。
标签: iphone ios objective-c nsurl