开发者

(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];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜