Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open VK app from my ios app

Tags:

ios

vk

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!

like image 521
mumble57 Avatar asked Aug 08 '14 14:08

mumble57


People also ask

Does VK have an app?

VKontakte unites tens of millions of people by offering unlimited features for communication, dating, entertainment, business and sharing news from anywhere around the world. On the app, you can listen to music, watch videos and clips, keep track of your health, play games, and shop.

What is VK for mobile devices?

VK is the largest social media networking site in Russia. It's ranked globally for all social networks, second only to Facebook. It ranks higher than Instagram and Twitter. VK also ranks #5 on the list of all websites available.

Is VK a Russian app?

Apple has removed VKontakte, a top Russian social media platform, from its app store, according to the app's developer. Apple's decision also affects other iOS apps produced by VKontakte's parent, the technology giant VK, according to a blog post Tuesday by the company.


1 Answers

This works for me in 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)
}
like image 83
Арсений Фещенко Avatar answered Sep 28 '22 08:09

Арсений Фещенко