无法识别的选择器发送到实例FIrebase注册/登录

时间:2017-06-14 01:18:24

标签: ios firebase swift3 firebase-authentication

您好我需要帮助,我已经阅读了其他一些解决方案,他们似乎没有帮助,因为他们都与手势或按钮有关。任何帮助表示赞赏。

这是我的代码:

import UIKit
import FirebaseAuth

class SignInVC: UIViewController {


    @IBOutlet weak var signInSelector: UISegmentedControl!  //Login/Sign Up Selector

    @IBOutlet weak var emailTextField: UITextField! //Text Field for Email

    @IBOutlet weak var passwordTextField: UITextField!  //Text Field for Password (Protected)

    @IBOutlet weak var loginButton: UIButton!   //Login Button

    @IBOutlet weak var loginLabel: UILabel! //Login Label

    var isLogin:Bool = true //Boolean for is Login Screen

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

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

    @IBAction func signInSelectorChanged(_ sender: UISegmentedControl) {
        isLogin = !isLogin  //Flip the boolean
        if isLogin {
            loginLabel.text = "Login"
            loginButton.setTitle("Login", for: .normal)
        } //If Statement
        else {
            loginLabel.text = "Sign Up"
            loginButton.setTitle("Sign Up", for: .normal)
        } //Else Statement
    }

    @IBAction func loginButtonTapped(_ sender: UIButton) {

        if let email = emailTextField.text, let pass = passwordTextField.text {
            if isLogin {
                //Login through Firebase
                Auth.auth().signIn(withEmail: email, password: pass, completion: { (user, error) in
                    if let u = user {
                        //User is found go to homescreen
                        self.performSegue(withIdentifier: "ContactsSegue", sender:  self)
                    }
                    else {
                        //Register the user with Firebase
                    }
                })
            } //If Statement
            else {
                //Register the user with Firebase
                Auth.auth().createUser(withEmail: email, password: pass, completion: { (user, error) in
                    if let u = user {
                        //User is found go to homescreen
                        self.performSegue(withIdentifier: "ContactsSegue", sender:  self)
                    } //If Statement
                    else {
                        //Register the user with Firebase
                    } //Else Statement
                })
            } //Else
        } //Overarching If Statement
    } //Sign Up Button
} //Class

这是我的控制台:

2017-06-13 22:39:07.809 Study M8[37297:4989605] Simulator user has requested new graphics quality: 10
2017-06-13 22:39:07.845 Study M8[37297] <Warning> [Firebase/Analytics][I-ACS005000] The AdSupport Framework is not currently linked. Some features will not function properly. Learn more at https://firebase.google.com/support/guides/analytics-adsupport
2017-06-13 22:39:07.901 Study M8[37297] <Notice> [Firebase/Analytics][I-ACS023007] Firebase Analytics v.4000000 started
2017-06-13 22:39:07.902 Study M8[37297] <Notice> [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://help.apple.com/xcode/mac/8.0/#/dev3ec8a1cb4)
2017-06-13 22:39:07.903 Study M8[37297] <Notice> [Firebase/Analytics][I-ACS003007] Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
2017-06-13 22:39:08.049 Study M8[37297] <Warning> [Firebase/Analytics][I-ACS032003] iAd framework is not linked. Search Ad Attribution Reporter is disabled.
2017-06-13 22:39:08.058 Study M8[37297] <Notice> [Firebase/Analytics][I-ACS023012] Firebase Analytics enabled
2017-06-13 22:39:08.459 Study M8[37297:4989766] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9806)
2017-06-13 22:39:08.537 Study M8[37297:4989605] <Firebase/Network/ERROR> Encounter network error. Code, error: -1200, Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={_kCFStreamErrorCodeKey=-9806, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, NSUnderlyingError=0x608000057d90 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, _kCFNetworkCFStreamSSLErrorOriginalValue=-9806, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9806}}, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=https://play.googleapis.com/log, NSErrorFailingURLStringKey=https://play.googleapis.com/log, _kCFStreamErrorDomainKey=3}
2017-06-13 22:39:08.538 Study M8[37297] <Error> [Firebase/Core][I-NET901017] <Firebase/Network/ERROR> Encounter network error. Code, error: -1200, Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={_kCFStreamErrorCodeKey=-9806, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, NSUnderlyingError=0x608000057d90 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, _kCFNetworkCFStreamSSLErrorOriginalValue=-9806, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9806}}, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=https://play.googleapis.com/log, NSErrorFailingURLStringKey=https://play.googleapis.com/log, _kCFStreamErrorDomainKey=3}
2017-06-13 22:39:08.539 Study M8[37297] <Error> [Firebase/Core][I-COR000020] Error posting to Clearcut: Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={_kCFStreamErrorCodeKey=-9806, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, NSUnderlyingError=0x608000057d90 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, _kCFNetworkCFStreamSSLErrorOriginalValue=-9806, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9806}}, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=https://play.googleapis.com/log, NSErrorFailingURLStringKey=https://play.googleapis.com/log, _kCFStreamErrorDomainKey=3}, with Status Code: 0
2017-06-13 22:39:08.877 Study M8[37297:4989766] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9806)
2017-06-13 22:39:08.882 Study M8[37297] <Error> [Firebase/InstanceID][I-IID003009] Failed to fetch default token Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={_kCFStreamErrorCodeKey=-9806, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, NSUnderlyingError=0x608000055f60 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, _kCFNetworkCFStreamSSLErrorOriginalValue=-9806, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9806}}, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=https://device-provisioning.googleapis.com/checkin, NSErrorFailingURLStringKey=https://device-provisioning.googleapis.com/checkin, _kCFStreamErrorDomainKey=3}
2017-06-13 22:39:12.065240+1000 Study M8[37297:4989605] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/jack.staples/Library/Developer/CoreSimulator/Devices/A86AAB47-B72B-41D0-9FE3-6BAA9F7097ED/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-06-13 22:39:12.076013+1000 Study M8[37297:4989605] [MC] Reading from private effective user settings.
2017-06-13 22:39:15.853614+1000 Study M8[37297:4989725] 0x608000347380 Copy matching assets reply: XPC_TYPE_DICTIONARY  <dictionary: 0x608000347380> { count = 1, transaction: 0, voucher = 0x0, contents =
    "Result" => <int64: 0x608000227a60>: 29
}
2017-06-13 22:39:15.854907+1000 Study M8[37297:4989725] 0x608000346a90 Daemon configuration query reply: XPC_TYPE_DICTIONARY  <dictionary: 0x608000346a90> { count = 2, transaction: 0, voucher = 0x0, contents =
    "Dictionary" => <dictionary: 0x608000346b40> { count = 1, transaction: 0, voucher = 0x0, contents =
        "ServerURL" => <dictionary: 0x608000346ca0> { count = 3, transaction: 0, voucher = 0x0, contents =
            "com.apple.CFURL.magic" => <uuid: 0x60800005da30> C3853DCC-9776-4114-B6C1-FD9F51944A6D
            "com.apple.CFURL.string" => <string: 0x60800005d6d0> { length = 30, contents = "https://mesu.apple.com/assets/" }
            "com.apple.CFURL.base" => <null: 0x112135f40>: null-object
        }
    }
    "Result" => <int64: 0x608000227b60>: 0
}
2017-06-13 22:39:15.855327+1000 Study M8[37297:4989725] [MobileAssetError:29] Unable to copy asset information from https://mesu.apple.com/assets/ for asset type com.apple.MobileAsset.TextInput.SpellChecker
2017-06-13 22:39:21.196 Study M8[37297:4989605] -[Study_M8.SignInVC login:]: unrecognized selector sent to instance 0x7fc1e040ec50
2017-06-13 22:39:21.243 Study M8[37297:4989605] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Study_M8.SignInVC login:]: unrecognized selector sent to instance 0x7fc1e040ec50'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010f877b0b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x000000010f2e3141 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010f8e7134 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x000000010f7fe840 ___forwarding___ + 1024
    4   CoreFoundation                      0x000000010f7fe3b8 _CF_forwarding_prep_0 + 120
    5   UIKit                               0x000000010fc9cd22 -[UIApplication sendAction:to:from:forEvent:] + 83
    6   UIKit                               0x000000010fe2125c -[UIControl sendAction:to:forEvent:] + 67
    7   UIKit                               0x000000010fe21577 -[UIControl _sendActionsForEvents:withEvent:] + 450
    8   UIKit                               0x000000010fe204b2 -[UIControl touchesEnded:withEvent:] + 618
    9   UIKit                               0x000000010fd0a49a -[UIWindow _sendTouchesForEvent:] + 2707
    10  UIKit                               0x000000010fd0bbb0 -[UIWindow sendEvent:] + 4114
    11  UIKit                               0x000000010fcb87b0 -[UIApplication sendEvent:] + 352
    12  UIKit                               0x000000011049badc __dispatchPreprocessedEventFromEventQueue + 2926
    13  UIKit                               0x0000000110493a3a __handleEventQueue + 1122
    14  CoreFoundation                      0x000000010f81dc01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    15  CoreFoundation                      0x000000010f8030cf __CFRunLoopDoSources0 + 527
    16  CoreFoundation                      0x000000010f8025ff __CFRunLoopRun + 911
    17  CoreFoundation                      0x000000010f802016 CFRunLoopRunSpecific + 406
    18  GraphicsServices                    0x0000000112f2ca24 GSEventRunModal + 62
    19  UIKit                               0x000000010fc9b0d4 UIApplicationMain + 159
    20  Study M8                            0x000000010d86c817 main + 55
    21  libdyld.dylib                       0x0000000111e6c65d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Blah blah填补空间。

1 个答案:

答案 0 :(得分:0)

您在login: viewcontroller中缺少SignInVC方法。

尝试在SignInVC viewcontroller中添加此功能。

@IBAction func login(_ sender: UIButton) {
    self.loginButtonTapped(sender)
}
相关问题