2017-02-21 4 views
-1

自分のコードでSIGABRTエラーが発生し続けるが、その理由は分かりません。 私は非常に単純なエラーを見過ごしていると感じ、私はそれを把握していないようです。IBAction Swiftでクラッシュする

UIButtonをクリックするたびに、アプリのクラッシュの問題がIBOutlet内にあるようです。

SIGABRTエラーがAppDelagate

SignInViewControllerの先頭から開始:

import UIKit 

import Firebase 
import GoogleSignIn 

@objc(SignInViewController) 
class SignInViewController: UIViewController, GIDSignInUIDelegate { 

    //@IBOutlet weak var signInButton: GIDSignInButton! 

    @IBOutlet weak var signInButton: GIDSignInButton! 

    // @IBOutlet weak var signInButton: GIDSignInButton! 
    var handle: FIRAuthStateDidChangeListenerHandle? 

    override func viewDidLoad() { 
     super.viewDidLoad() 
     GIDSignIn.sharedInstance().uiDelegate = self 
     GIDSignIn.sharedInstance().signInSilently() 
     handle = FIRAuth.auth()?.addStateDidChangeListener() { (auth, user) in 
      if user != nil { 
       MeasurementHelper.sendLoginEvent() 
       self.performSegue(withIdentifier: Constants.Segues.SignInToFp, sender: nil) 
      } 
     } 
    } 

    deinit { 
     if let handle = handle { 
      FIRAuth.auth()?.removeStateDidChangeListener(handle) 
     } 
    } 
} 

Applegate.swift:

import UIKit 
// UserNotifications are only required for the optional FCM step 
import UserNotifications 

import Firebase 
import GoogleSignIn 

@UIApplicationMain 
class AppDelegate: UIResponder, UIApplicationDelegate, GIDSignInDelegate { 

    var window: UIWindow? 

    @available(iOS 9.0, *) 
    func application(_ application: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) 
     -> Bool { 
      return self.application(application, open: url, sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String, annotation: "") 
    } 

    func application(_ application: UIApplication, 
        open url: URL, sourceApplication: String?, annotation: Any) -> Bool { 
     return GIDSignIn.sharedInstance().handle(url, sourceApplication: sourceApplication, annotation: annotation) 
    } 

    func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error?) { 
     if let error = error { 
      print("Error \(error)") 
      return 
     } 

     guard let authentication = user.authentication else { return } 
     let credential = FIRGoogleAuthProvider.credential(withIDToken: authentication.idToken, 
                  accessToken: authentication.accessToken) 
     FIRAuth.auth()?.signIn(with: credential) { (user, error) in 
      if let error = error { 
       print("Error \(error)") 
       return 
      } 
     } 
    } 

    func application(_ application: UIApplication, didFinishLaunchingWithOptions 
     launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 


     FIRApp.configure() 
     GIDSignIn.sharedInstance().clientID = FIRApp.defaultApp()?.options.clientID 
     GIDSignIn.sharedInstance().delegate = self 

     return true 
    } 
} 
+1

より有用な情報を提供することはできますか?これから、情報源を見つけるのは難しいでしょう。 – aircraft

+0

ボタンが配置されているUIButtonとView Controllerはどちらですか? –

答えて

0

これが原因未使用IBOutlet通常です。 storyboardのアウトレットを右クリックし、viewcontrollerで使用されていない/使用されていないコンセントをすべて外します(xをクリックします)。

関連する問題