【发布时间】:2012-05-05 13:23:21
【问题描述】:
我正在使用此代码将按钮的链接分配给 wiki 页面,同时将 UILabel 中的 countryName.text 捕获为 URL 的一部分,但是当我按下它时 Xcode 给我一个错误。代码如下:
- (IBAction)openWiki:(id)sender {
NSString *sampleUrl = [[NSString alloc] initWithFormat:@"http://en.wikipedia.org/wiki/%@%@",self.countryName.text];
NSURL *wikiUrl = [[NSURL alloc] initWithString:sampleUrl];
[[UIApplication sharedApplication] openURL:wikiUrl];}
提前致谢。
【问题讨论】:
-
您在 XCODE 上遇到的错误是什么?
-
去掉 %@ 符号之一。
标签: iphone objective-c ios xcode nsurl