Why does this:
NSString *url =开发者_运维知识库 [NSString stringWithFormat:@"http://www.example.com/profile/%@/?s_iphone=true", author];
NSLog(@"url: %@", url);
Output this:
http://www.example.com/profile/AuthorName
/?s_iphone=true
Needless to say the url won't load b/c there is a newline added to the string by itself. I've tried removing whitesapces/newlines and still had the same output. Its driving me crazy.
Matt
Try this -
NSString *url = [NSString stringWithFormat:@"http://www.example.com/profile/%@/?s_iphone=true", [author stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
NSLog(@"url: %@", url);
It will fix any new line characters at the beginning and end of your author
string.
Author definitely has a new line in it. Try this:
NSLog(@"The author is %@ on a new line?", author);
精彩评论