首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >VK iOS sdk授权

VK iOS sdk授权
EN

Stack Overflow用户
提问于 2015-06-29 14:41:21
回答 1查看 4.4K关注 0票数 4

我试图在一个SWIFT2.0项目中设置。我得到了一个错误,我不知道为什么会发生。

AppDelegate.swift

代码语言:javascript
复制
//
//  AppDelegate.swift
//  iosVKMusic
//
//  Created by Nick on 25.06.15.
//  Copyright © 2015 Funtrum. All 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

代码语言:javascript
复制
//
//  ViewController.swift
//  iosVKMusic
//
//  Created by Nick on 25.06.15.
//  Copyright © 2015 Funtrum. All 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 any resources that can be recreated.
    }
}

布里吉德·海德尔h

代码语言:javascript
复制
//
//  -Bridging-Header.h
//  iosVKMusic
//
//  Created by Nick on 28.06.15.
//  Copyright © 2015 Funtrum. All rights reserved.
//

#ifndef _Bridging_Header_h
#define _Bridging_Header_h


#endif /* _Bridging_Header_h */

#import "VKSdk.h"

Autorize VKSdk.autorize(...)返回以下错误:

2015-06-29 16:11:14.931 iosVKMusic554:75899 -canOpenURL: failed for URL:"vkauthorize://authorize“--错误:”此应用程序不允许查询方案vkauthorize“

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-06-29 16:11:19

我通过将此错误添加到Info.plist来修复此错误

代码语言:javascript
复制
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>vkauthorize</string>
</array>
票数 17
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31118600

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档