ios - Swift : why Safari doesn't open? -
ios - Swift : why Safari doesn't open? -
i set button function loading oauthswift, when click on breakpoint on function goes well, safari doesn't start dribbble authentification link.
what have ?
my button
@ibaction func loginbutton(sender: anyobject) { func dooauthdribbble(){ allow oauthswift = oauth2swift( consumerkey: dribbble["consumerkey"]!, consumersecret: dribbble["consumersecret"]!, authorizeurl: "https://dribbble.com/oauth/authorize", accesstokenurl: "https://dribbble.com/oauth/token", responsetype: "code" ) oauthswift.authorizewithcallbackurl( nsurl(string: "dribs://oauth-callback/dribbble")!, scope: "public+write+comment+upload", state: "", success: { credential, response in // user var parameters = dictionary<string, anyobject>() oauthswift.client.get("https://api.dribbble.com/v1/user?access_token=\(credential.oauth_token)", parameters: parameters, success: { data, response in allow jsondict: anyobject! = nsjsonserialization.jsonobjectwithdata(data, options: nil, error: nil) println(jsondict) }, failure: {(error:nserror!) -> void in println(error) }) }, failure: {(error:nserror!) -> void in println(error.localizeddescription) }) } } the webviewcontroller
class webviewcontroller: oauthwebviewcontroller, uiwebviewdelegate { var targeturl : nsurl = nsurl() allow webview : uiwebview = uiwebview() override func viewdidload() { super.viewdidload() self.webview.frame = uiscreen.mainscreen().applicationframe self.webview.scalespagetofit = true self.webview.delegate = self self.view.addsubview(self.webview) loadaddressurl() } override func didreceivememorywarning() { super.didreceivememorywarning() } override func seturl(url: nsurl) { targeturl = url } func loadaddressurl() { allow req = nsurlrequest(url: targeturl) self.webview.loadrequest(req) } func webview(webview: uiwebview, shouldstartloadwithrequest request: nsurlrequest, navigationtype: uiwebviewnavigationtype) -> bool { if (request.url!.scheme == "dribs"){ self.dismissviewcontrolleranimated(true, completion: nil) } homecoming true } }
ios swift
Comments
Post a Comment