mumble57 mumble57 - 4 months ago 42
iOS Question

How to open VK app from my ios app

I want to open my public page in vk app (if it is installed). How can I manage to do that

Here's the same trick with 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!

Ned Ned
Answer

Hi it should help you :)

NSURL *url = [[NSURL alloc] initWithString:@"vk://vk.com/ХХХ"];
[[UIApplication sharedApplication] openURL:url];
Comments