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