Iphone '#';ios中的字符Twitter帖子url

Iphone '#';ios中的字符Twitter帖子url,iphone,ios,url,twitter,Iphone,Ios,Url,Twitter,我试图在twitter上自动发布一个带有“#”字符的url,如下所示: https://twitter.com/intent/tweet?related=palcomp3&text=Confira!!&url=http://palcomp3.com/avioesdoforro/#!/de-costa-mainha 然而,Twitter忽略了# 这是我尝试的代码: [webView setUrlAddress:[NSString stringWithString:@"https:

我试图在twitter上自动发布一个带有“#”字符的url,如下所示:

https://twitter.com/intent/tweet?related=palcomp3&text=Confira!!&url=http://palcomp3.com/avioesdoforro/#!/de-costa-mainha
然而,Twitter忽略了
#

这是我尝试的代码:

[webView setUrlAddress:[NSString stringWithString:@"https://twitter.com/intent/tweet?related=palcomp3&text=Confira!!&url=http://palcomp3.com/avioesdoforro/#!/de-costa-mainha"]];


很可能是由于编码的原因,请尝试使用StringByAddingPercenteScapesusingEncode获取URL安全字符串,并将其用作URL

NSString *str=[NSString stringWithString:@""https://twitter.com/intent/tweet?related=palcomp3&text=Confira!!&url=http://palcomp3.com/avioesdoforro/#!/de-costa-mainha"];
str=[str  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[webView setUrlAddress:str];

很可能是由于编码的原因,请尝试使用StringByAddingPercenteScapesusingEncode获取URL安全字符串,并将其用作URL

NSString *str=[NSString stringWithString:@""https://twitter.com/intent/tweet?related=palcomp3&text=Confira!!&url=http://palcomp3.com/avioesdoforro/#!/de-costa-mainha"];
str=[str  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[webView setUrlAddress:str];