开发者

(iPhone app) error: too many arguments to function 'URLWithString:'

I'm trying to format a URL string however it's saying there are too many arguments. My code is below:

-(IBAction)tweetRandom {

 //NSLog(@"CALLED");
 test = 100;
 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://twitter.com/%i", test]]; // problem line

}

Anyone know开发者_开发技巧 how to format the URL? Was hoping there was something by the name of URLWithFormat but it doesn't exist.


You need to use stringWithFormat: like this:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://twitter.com/%i", test]]];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜