2016-03-04 63 views
0

我與斯威夫特2碼出了問題,問題如下:谷歌簽到+ Facebook的

我實現登錄與Facebook和谷歌,但在分別在AppDelegate中應用的兩個特徵不希望有人能夠幫助我讓他們工作?

我嘗試了不同的代碼,結果很差,只能一次一個地工作。

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool { 
    return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation) 
} 

func application(application: UIApplication, openURL url: NSURL, options: [String: AnyObject]) -> Bool { 
    return GIDSignIn.sharedInstance().handleURL(url, sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String, annotation: options[UIApplicationOpenURLOptionsAnnotationKey]) 
} 

回答

1

解決方案:

func application(application: UIApplication, 
     openURL url: NSURL, 
     sourceApplication: String?, 
     annotation: AnyObject) -> Bool { 
    if (GIDSignIn.sharedInstance().handleURL(url, sourceApplication: sourceApplication, annotation: annotation)) 
    { 
     return true 
    } 
    else if (FBSDKApplicationDelegate.sharedInstance().application(
     application, 
     openURL: url, 
     sourceApplication: sourceApplication, 
     annotation: annotation)) 
    { 
    return true 
    } 
    return false 
    }