有谁知道如何打开带有预填充文本的 Facebook Messenger 应用程序?
例如,要在指定用户处打开 Messenger 应用程序,您可以编写以下代码:
NSURL *fbURL = [NSURL URLWithString:@"fb-messenger://user-thread/USER_ID"];
if ([[UIApplication sharedApplication] canOpenURL: fbURL]) {
[[UIApplication sharedApplication] openURL: fbURL];
}
对于 Whats 应用程序非常简单:
NSURL *whatsappURL = [NSURL URLWithString:[NSString stringWithFormat:@"whatsapp://send?text=%@", @"String to post here"]];
if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
[[UIApplication sharedApplication] openURL: whatsappURL];
}