Latest 2.0.6
Homepage https://github.com/apiok/ok-ios-sdk
License MIT
Platforms ios 7.0, requires ARC
Authors

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

OK IOS SDK 2.0.5

Join the chat at https://gitter.im/apiok/ok-ios-sdk

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. Then add ok{appId} and okauth to LSApplicationQueriesSchemes.
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

Latest podspec

{
    "name": "ok-ios-sdk",
    "version": "2.0.6",
    "summary": "iOS library for working with OK API.",
    "homepage": "https://github.com/apiok/ok-ios-sdk",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Dmitry Grytsovets": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/apiok/ok-ios-sdk.git",
        "tag": "2.0.6"
    },
    "source_files": "*.{h,m}",
    "public_header_files": "*.h",
    "requires_arc": true
}

Pin It on Pinterest

Share This