F
F
femalemoustache2016-11-28 11:46:21
iOS
femalemoustache, 2016-11-28 11:46:21

How to fix error when calling VKSdk.authorize()?

I'm trying to attach to the VKSdk application. When I try to call VKSdk.authorize(scope) I get an error:

-canOpenURL: failed for URL: "vkauthorize://authorize" - error: "Не удалось завершить операцию. (OSStatus, ошибка -10814)"

Actions taken
  1. Created a standalone Vkontakte application.
  2. I set up URL-types in info.plist of the application according to the manual from Twitter. At the URL vkXXXXXXX:// entered into Safari, the application opens.
  3. Configured LSApplicationQueriesSchemes in info.plist of the application
  4. Added method to AppDelegate:
    func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
            VKSdk.processOpen(url, fromApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String!)
            
            let sdkInstance = VKSdk.initialize(withAppId: "VK_APP_ID")
            sdkInstance!.register(self)
            sdkInstance!.uiDelegate = self
            
            let scope = ["friends", "email"]
            VKSdk.wakeUpSession(scope, complete: {(state: VKAuthorizationState, error: Error?) -> Void in
                if state == .authorized {
                    NSLog("authorized")
                } else {
                    VKSdk.authorize(scope)
                }
                return
            })
            
    
            return true
        }

  5. I run the application in the emulator (IOS 10.0). I go to Safari, enter vkXXXXXXXXXX:// in the address bar. A dialog box opens asking you to open the application. After confirmation, the above code is executed and at the time of calling VKSdk.authorize (scope) I get the error voiced at the beginning.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Semchenko, 2016-11-28
@0xcffaedfe

Well, they googled what a mistake, why run here? -> https://www.osstatus.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question