iphone - '#' 字符 Twitter 在 ios 中发布 url

标签 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.com/intent/tweet?related=palcomp3&text=Confira!!&url=http://palcomp3.com/avioesdoforro/#!/de-costa-mainha"]];

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

最佳答案

很可能是由于编码问题,请尝试使用 stringByAddingPercentEscapesUsingEncoding 获取 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];

关于iphone - '#' 字符 Twitter 在 ios 中发布 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8703282/

相关文章:

iphone - 释放由 GLKTextureLoader 分配的纹理(GLKTextureInfo 对象)

iphone - 转码段文件无卡顿,用于 http 直播

iphone - UILineBreakMode 与 NSLineBreakMode

ios - 在没有 Cognito API 的情况下使用 DynamoDB

ios - 从 TestFlight 打开时应用程序崩溃,但在其他情况下工作正常

Python URL 和目标列表

php - 在 url mod_rewrite 中隐藏扩展名 .php

iphone - 下一个按钮不浏览 UITextField