【发布时间】:2012-06-14 10:59:17
【问题描述】:
在 iOS 5 上,我试图打开一个带有动态标签搜索词的本地 Twitter 应用程序。
我试过了:
- (void)openForHashTag:(NSString *)hashTag {
UIApplication *app = [UIApplication sharedApplication];
NSURL *twitterURL = [NSURL URLWithString:[NSString stringWithFormat:@"twitter://search?q=%@", hashTag]];
DLog(@"Hashtag URL: %@ ", twitterURL);
if ([app canOpenURL:twitterURL]) {
[app openURL:twitterURL];
}
else {
NSURL *safariURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://mobile.twitter.com/search?q=%@", hashTag]];
[app openURL:safariURL];
}
}
它似乎进入了标签搜索页面,但永远加载... twitter://search?q=%@ 格式错误吗?
【问题讨论】:
标签: objective-c ios twitter nsurl hashtag