(iPhone)URL formatting question
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开发者_Go百科=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.
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];
精彩评论