ios - 无法将字符串设置为 URLWithString

标签 ios nsstring nsobject url-scheme

我对 Facebook 页面的操作有疑问。

currentVriend 是一个 NSObject 类。

我收到错误:方法调用的参数太多,预期 1 有 2

-(void)goFB
{
    NSURL *url = [NSURL URLWithString:@"fb://profile/%g",self.currentVriend.fbid];
    [[UIApplication sharedApplication] openURL:url];
}

我做错了什么? 也许制作另一个 String? 谢谢

最佳答案

我相信你错过了正确的 NSString 方法

NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"fb://profile/%g",self.currentVriend.fbid]];

关于ios - 无法将字符串设置为 URLWithString,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25558473/

相关文章:

ios - 如何让 XLPagerTabStrip 将选定的选项卡居中?

objective-c - 测量 cocoa 中的绳子高度

ios - Objective-c:我怎样才能要求覆盖而不是调用 super ?

iOS5 : How to use a UIActionSheet object in an NSObject class and cause it to appear in another view?

objective-c - 将 NSNumber 对象分配给 NSString 对象不会导致任何错误或警告

ios - 导航栏不出现

ios - 从 TabBar 弹出

ios - xcodebuild:错误:未知的构建操作

ios - NSString 中的 Unicode 符号尺寸错误

iphone - 使用 NSISOLatin1StringEncoding 转换语言字符 [ios]