Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在IOS上使用Facebook应用程序打开Facebook群组页面_Ios_Facebook - Fatal编程技术网

在IOS上使用Facebook应用程序打开Facebook群组页面

在IOS上使用Facebook应用程序打开Facebook群组页面,ios,facebook,Ios,Facebook,在我的IOS应用程序中,我想向一个组打开facebook应用程序 在Android上,我只打开了以下URL: “fb://group/12345678/”(我在本例中替换了组id) 这在android上运行良好。在IOS中尝试相同操作时: [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"fb://group/12345678/"]]; Facebook应用程序打开,但我得到: 您访问的链接可能已断开,或者页面

在我的IOS应用程序中,我想向一个组打开facebook应用程序

在Android上,我只打开了以下URL:

“fb://group/12345678/”(我在本例中替换了组id)

这在android上运行良好。在IOS中尝试相同操作时:

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"fb://group/12345678/"]];
Facebook应用程序打开,但我得到:

您访问的链接可能已断开,或者页面可能已被删除

我找不到任何其他方式从IOS向公众facebook群组开放


谢谢

尝试使用“profile”而不是“group”(例如
URLWithString:@“fb://profile/144754840”
)。

您可以使用id页面,如下所示:

ObjC

迅捷3

func openFBGroup(groupID: String = "12345678") -> Bool {
    guard let url = URL(string: "fb://page/?id=\(groupID)") else { return false }
    guard UIApplication.shared.canOpenURL(url) else { return false }
    UIApplication.shared.open(url, options: [], completionHandler: nil)
    return true
}
迅捷4

@discardableResult func openFBGroup(groupID: String = "12345678") -> Bool {
    guard let url = URL(string: "fb://page/?id=\(groupID)") else { return false }
    guard UIApplication.shared.canOpenURL(url) else { return false }
    return UIApplication.shared.openURL(url)
}

要在facebook应用程序中打开群组,只需打开完整url:

NSURL *url = [NSURL URLWithString:@"https://www.facebook.com/gropId"]
[[UIApplication sharedApplication] openURL:url];

而是
https://fb.com/gropId

您可以使用个人资料和组ID在Facebook应用程序中打开Facebook组,详细代码:

NSURL *facebookGroupURL = [NSURL URLWithString:@"fb://profile/123456/"];
if ([[UIApplication sharedApplication] canOpenURL:facebookGroupURL]) {
    [[UIApplication sharedApplication] openURL:facebookGroupURL];
}
else {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.facebook.com/groups/123456/"]];
}
浏览:

流动电话:


它在Xcode 9.1/iOS 11.1.2上对我有效这只是在Facebook应用程序中加载一个完全空白的页面。我如何找到fb groupID?@dip它在组的URL中。检查末尾的数字
NSURL *facebookGroupURL = [NSURL URLWithString:@"fb://profile/123456/"];
if ([[UIApplication sharedApplication] canOpenURL:facebookGroupURL]) {
    [[UIApplication sharedApplication] openURL:facebookGroupURL];
}
else {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.facebook.com/groups/123456/"]];
}