VKCOM / vk-ios-sdk

iOS library for working with VK API, authorization through VK app, using VK functions
MIT License
298 stars 165 forks source link

-canOpenURL: failed for URL: "vkauthorize://authorize" #530

Open cdjun100ying2 opened 6 years ago

cdjun100ying2 commented 6 years ago

login with not install vk app will print this message "-canOpenURL: failed for URL: "vkauthorize://authorize" - error: "(null)"" if install vk app it will ok. i use this code for login: NSArray *SCOPE = @[@"email"]; [VKSdk authorize:SCOPE];

romul commented 6 years ago

I have the same issue. More details:

canOpenURL: failed for URL: "vkauthorize://authorize" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
[Warning] Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<SFSafariViewController: 0x7ff91d029800>)
romul commented 6 years ago

I've found a solution.. In case when user has no vk app installed, you need implement vkSdkShouldPresent of VKSdkUIDelegate in your login view controller:

func vkSdkShouldPresent(_ controller: UIViewController!) {
        if (self.presentedViewController != nil) {
            self.dismiss(animated: true, completion: {
                print("hide current modal controller if presents")
                self.present(controller, animated: true, completion: {
                    print("SFSafariViewController opened to login through a browser")
                })
            })
        } else {
            self.present(controller, animated: true, completion: {
                print("SFSafariViewController opened to login through a browser")
            })
        }
    }
NikKovIos commented 3 years ago

10814 это ошибка kLSApplicationNotFoundErr https://www.osstatus.com/search/results?platform=all&framework=all&search=10814