[英]How to open VK app from my ios app
I want to open my public page in vk app (if it is installed). 我想在vk app中打开我的公共页面(如果已安装)。 How can I manage to do that
我怎样才能做到这一点
Here's the same trick with facebook 这是与facebook相同的技巧
- (IBAction)facebook:(id)sender{
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://profile/1425897281000202"]]){
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"fb://profile/1425897281000202"]];
NSURL *url = [NSURL URLWithString:@"fb://profile/1425897281000202"];
[[UIApplication sharedApplication] openURL:url];
}
else {
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:@"https://www.facebook.com/GooodApps"]];
}
}
Thanx! 感谢名单!
Hi it should help you :) 嗨,它应该帮助你:)
NSURL *url = [[NSURL alloc] initWithString:@"vk://vk.com/ХХХ"];
[[UIApplication sharedApplication] openURL:url];
This works for me in Swift: 这在Swift中对我有用:
let appURL = NSURL(string: "vk://vk.com/id\(user.vkID)")!
let safariURL = NSURL(string: "vk.com/id\(user.vkID)")!
if UIApplication.sharedApplication().canOpenURL(appURL){
UIApplication.sharedApplication().openURL(appURL)
} else {
UIApplication.sharedApplication().openURL(safariURL)
}
let appURL = NSURL(string: "vk://vk.com/id1")!
let safariURL = NSURL(string: "vk.com/id1")!
if UIApplication.sharedApplication().openURL(appURL){
UIApplication.sharedApplication().openURL(safariURL))
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.