swift - VK iOS sdk authorize -
i'm trying setup vk ios sdk in swift 2.0 project. i'm getting error , don't have idea why occurs.
appdelegate.swift:
// // appdelegate.swift // iosvkmusic // // created nick on 25.06.15. // copyright © 2015 funtrum. rights reserved. // import uikit @uiapplicationmain class appdelegate: uiresponder, uiapplicationdelegate { var window: uiwindow? func application(application: uiapplication, openurl url: nsurl, sourceapplication: string?, annotation: anyobject) -> bool { let ret:bool = vksdk.processopenurl(url, fromapplication: sourceapplication) return ret } }
viewcontroller.swift:
// // viewcontroller.swift // iosvkmusic // // created nick on 25.06.15. // copyright © 2015 funtrum. rights reserved. // import uikit extension viewcontroller: vksdkdelegate { func vksdkneedcaptchaenter(captchaerror: vkerror) { } func vksdktokenhasexpired(expiredtoken: vkaccesstoken) { } func vksdkuserdeniedaccess(authorizationerror: vkerror) { } func vksdkshouldpresentviewcontroller(controller: uiviewcontroller) { } func vksdkreceivednewtoken(newtoken: vkaccesstoken) { } } class viewcontroller: uiviewcontroller { let token_key = "my_application_access_token" override func viewdidload() { super.viewdidload() vksdk.initializewithdelegate(self, andappid: "4314639") } @ibaction func authtouchup(sender: uibutton) { if (vksdk.wakeupsession()) { print("wakeupsession", appendnewline: true) } else { print("else", appendnewline: true) vksdk.authorize([vk_per_audio, vk_per_offline], revokeaccess: true) } } func vksdkacceptedusertoken(token: vkaccesstoken!) { print("accepted", appendnewline: true) } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } }
bridgind header.h:
// // -bridging-header.h // iosvkmusic // // created nick on 28.06.15. // copyright © 2015 funtrum. rights reserved. // #ifndef _bridging_header_h #define _bridging_header_h #endif /* _bridging_header_h */ #import "vksdk.h"
autorize vksdk.autorize(...)
returns error:
2015-06-29 16:11:14.931 iosvkmusic[554:75899] -canopenurl: failed url: "vkauthorize://authorize" - error: "this app not allowed query scheme vkauthorize"
i fix error adding info.plist
<key>lsapplicationqueriesschemes</key> <array> <string>vkauthorize</string> </array>
Comments
Post a Comment