2016-08-18 5 views
0

私はSwiftを使ってiOSのFirebaseでGoogleログインを実装しました。これは、これらのiPhoneのシミュレータ(5,5S、6,6S、6Sプラス)で動作します。それは6プラスでのみ動作しません。 LoginViewController内のサインインボタンを何回クリックしても、Googleログインページは開かれません。なぜこれが当てはまるのかについての考えはありますか?iOSを入手する方法すべてのiPhoneシミュレータでFirebaseを使用してGoogleにサインインしますか?

ここに私のAppDelegate.swiftとLoginViewController.swiftコードがあります。

// 
// AppDelegate.swift 
// 
// 
// 
// 

import UIKit 
import Firebase 
import GoogleSignIn 

@UIApplicationMain 
class AppDelegate: UIResponder, UIApplicationDelegate, GIDSignInDelegate { 

    var window: UIWindow? 


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 
     // Override point for customization after application launch. 
     FIRApp.configure() 
     GIDSignIn.sharedInstance().clientID = FIRApp.defaultApp()?.options.clientID 
     GIDSignIn.sharedInstance().delegate = self 
     return true 
    } 

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

    } 

    func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!, 
     withError error: NSError!) { 
      if let error = error { 
       print(error.localizedDescription) 
       return 
      } 
      let authentication = user.authentication 
      let credential = FIRGoogleAuthProvider.credentialWithIDToken(authentication.idToken, 
       accessToken: authentication.accessToken) 


      FIRAuth.auth()?.signInWithCredential(credential) { (user, error) in 
       // ... 
      } 
    } 

    func signIn(signIn: GIDSignIn!, didDisconnectWithUser user:GIDGoogleUser!, 
     withError error: NSError!) { 
      // Perform any operations when the user disconnects from app here. 
      // ... 
    } 



    func applicationWillResignActive(application: UIApplication) { 
     // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 
     // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 
    } 

    func applicationDidEnterBackground(application: UIApplication) { 
     // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
     // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 
    } 

    func applicationWillEnterForeground(application: UIApplication) { 
     // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 
    } 

    func applicationDidBecomeActive(application: UIApplication) { 
     // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 
    } 

    func applicationWillTerminate(application: UIApplication) { 
     // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 
    } 


} 


// 
// ViewController.swift 
// 
// 
// 
// 

import UIKit 
import Firebase 
import GoogleSignIn 

class LogInViewController: UIViewController,GIDSignInUIDelegate { 





    @IBOutlet weak var GoogleSignInButton: UIButton! 

    @IBAction func Clicked(sender: UIButton) { 
     GIDSignIn.sharedInstance().uiDelegate = self 
     GIDSignIn.sharedInstance().signIn(); 
    } 


    override func viewDidLoad() { 
     super.viewDidLoad() 


     GIDSignIn.sharedInstance().uiDelegate = self 

     // Uncomment to automatically sign in the user. 


    // TODO(developer) Configure the sign-in button look/feel: 
     //GIDSignIn.sharedInstance().signInSilently() 



     // ... 
     // Do any additional setup after loading the view, typically from a nib. 
    } 





    override func didReceiveMemoryWarning() { 
     super.didReceiveMemoryWarning() 
     // Dispose of any resources that can be recreated. 
    } 


} 
+0

xcodeログの内容は何ですか? –

+0

何も違いはありません。 Firebase Authが動作しています。 – tanasn

答えて

0

固定。私のバージョンのXcodeの6 plusエミュレータは、Firebase Analyticsが有効になっていてもHTTPコールをブロックしていました。

関連する問題