ok-ios-sdk 2.0.14

ok-ios-sdk 2.0.14

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2016

Maintained by Denis Ivanov, Dmity Grytsovets.



ok-ios-sdk 2.0.14

  • By
  • Dmitry Grytsovets

Join our chat on the app: Telegram Messenger, https://telegram.me/joinchat/An0xvgHDHvWlSWNQWuzOkQ

OK IOS SDK 2.0.14

If you are looking for the old version, please checkout tag 1.0

How to use

First you should select External and IOS platforms and enable Client OAuth authorization using ok.ru app edit form. Also your should send request for LONG_ACCESS_TOKEN to api-support or you can simple not request for LONG_ACCESS_TOKEN permission during OAuth authorization.

Add ok{appId} schema to your app Info.plist file. For example ok12345 if your app has appId 12345. Don't forget add ok{appId}://authorize to allowed redirect urls for your application in ok.ru app profile. Also you should add next block to your Info.plist file.

 <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>

Add OKSDK.h and OKSDK.m to your project. For example you can use git submodule.

Init your sdk in AppDelegate didFinishLaunchingWithOptions

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    OKSDKInitSettings *settings = [OKSDKInitSettings new];
    settings.appKey = @"ABCDEFGABCDEGF";
    settings.appId = @"12345";
    settings.controllerHandler = ^{
        return self.window.rootViewController;
    };
    [OKSDK initWithSettings: settings];
    return YES;
}

Add openUrl to AppDelegate openURL

-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    [OKSDK openUrl:url];
    return YES;
}

To understand how to interact with OKSDK please look at examples repository