Documentation
v0.5.0
iOSAndroidJavaScript

VKit Guide

Let's Begin Integrating

Installing VKit

First get the latest version of VKit here.

Install VKit into your project by selecting the project file and going into the General tab.

General Tab

There you should tap on the + button under the Embedded Binaries section.

Embedded Section

When the Choose items to add: dialog box is shown, click on the Add Other button.

Choose Item Dialog

A file chooser dialog should come up and from there you should locate and select VKit.framework file.

In the Choose options for adding these files dialog, ensure that Copy items if needed and Create groups are selected. Click on Finish

Option Dialog

You're all set and VKit has been installed into your project.

Integrate VKit

There are two ways to be authorized in V: secured and unsecured. Secured way: please pass your user id(can be any unique string) to sessions api to obtain V user auth token.

Unsecured way: DANGER, only for testing purposes. After you got your app ID and app secret token, you can authorize your app in V by app secret token.

Go to your AppDelegate.swift or AppDelegate.m and be sure to import the framework.

import VKit

Add these codes in the following functions.

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // ... Your code ...

    // These 5 lines of code are needed
    VKAccount.current.secureModeEnabled = true
    VKAccount.current.authToken = "current user auth token"
    VKAccount.current.appID = "your app id"
    VKAccount.current.startSession { (accountState, error) in
    // ... Your code ...
    }

//  Or use following code for unsecure authorization, use it only during development

    VKAccount.current.secureModeEnabled = false
    VKAccount.current.appSecretToken = "your app secret token"
    VKAccount.current.appID = "your app id"
    VKAccount.current.startSession { (accountState, error) in
     // ... Your code ...
    }

}

Instead of reacting in startSession callback, you can subscribe to VKNotificationConstants.AccountStateChanged notification and observe it's state.

    NotificationCenter.default.addObserver(forName: Notification.Name(rawValue: VKNotificationConstants.AccountStateChanged), object: nil, queue: OperationQueue.main) { (_) in
    // ... Your code ...
    }

func applicationWillTerminate(application: UIApplication) {
    // ... Your code ...

    VKAccount.current.stopSession()

    // ... Your code ...
}

Verify VKit Works

Run your project and in your console output you should see the following:

[VKit] Session started!

Ready to Develop?

Now that you've successfuly installed and integrated VKit into your project lets start the fun!

Click on the area that you're interested in.

Areas Description
Query Videos Focus on getting a playlist of videos from the store service.
Playing Videos Here you will learn about the video player and how to play a video.
Recording Videos Learn to use the recorder view to record videos that will get stored into the store.