views:

43

answers:

1

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.

+1  A: 

You need to use stringWithFormat: like this:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://twitter.com/%i", test]]];
lucius
Oh, ok, thanks!
Alex