如何在iPhone应用程序中传递url中的字符串值?

时间:2014-11-01 10:24:51

标签: ios objective-c

我有网址我想在此网址Self.Id中传递cid=self.Id。我正在通过以下原因,但结果无效请求。

    NSURL *url = [NSURL URLWithString: 
    @"http://sms.instatalkcommunications.com/apireq/GetCommentsForSMS?
     t=1&h=admin&last=0&cid=Self.Id&items=5"];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
   [request setRequestMethod:@"GET"];
   [request setDidFailSelector:@selector(requestCompleted:)];
   [request setDelegate:self];
   [request startAsynchronous];

1 个答案:

答案 0 :(得分:3)

[NSURL URLWithString:[NSString stringWithFormat:@"http://sms.instatalkcommunications.com/apireq/GetCommentsForSMS?
     t=1&h=admin&last=0&cid=%@&items=5",Self.Id]];