views:

13

answers:

1

Hi,

I am trying to format a URL but am getting a bug out of it. My code is below.

NSString *twitterURL = [NSString stringWithFormat:@"http://twitter.com/?status=My%20score%20is:%i%20and%20CharsPerMin%20is:%@", currentScore, charPerMin.text]; 

When calling the method it doesn't do a thing. I think the issue is with %20. %20 is being used to space each word in the URL.

+2  A: 

You need to escape your % signs by doubling them:

NSString *twitterURL = [NSString stringWithFormat:@"http://twitter.com/?status=My%%20PracticeTyper%%20score%%20is:%i%%20and%%20CharsPerMin%%20is:%@", currentScore, charPerMin.text];
Senseful
Oh ok, thank you. Works great.
Alex