DaffodilGirl 2013-02-27 02:27 采纳率: 0%
浏览 3334
已采纳

ios-NSURL字符串如何批量传递参数

创建了一个应用,需要在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]];

不知道这段代码能实现么?需要什么地方改进么?多谢您的指点。

  • 写回答

1条回答

  • 空杯子_ 2013-03-04 07:50
    关注
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://rate-exchange.appspot.com/currency?from=%@&to=%@&q=%@",strfrom,strto,strgo]];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    

    这样就ok了。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器