Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/118.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 当我运行代码时,我不断得到错误线程1:SIGABRT信号。有什么想法吗?_Ios_Swift_Xcode_Firebase_Sigabrt - Fatal编程技术网

Ios 当我运行代码时,我不断得到错误线程1:SIGABRT信号。有什么想法吗?

Ios 当我运行代码时,我不断得到错误线程1:SIGABRT信号。有什么想法吗?,ios,swift,xcode,firebase,sigabrt,Ios,Swift,Xcode,Firebase,Sigabrt,这是我第一次使用Firebase,我正在尝试在Xcode上创建一个新用户。有人有办法吗 以下是我在AppDelegate.swift上的代码: import Firebase import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication,

这是我第一次使用Firebase,我正在尝试在Xcode上创建一个新用户。有人有办法吗

以下是我在AppDelegate.swift上的代码:

import Firebase
import UIKit


@UIApplicationMain

class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
    FirebaseApp.configure()

    return true
}

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 invalidate graphics rendering callbacks. 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 active 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:.
这是我在SignUpViewController.swift上的代码:

import UIKit
import Firebase
import FirebaseAuth


class SignUpViewController: UIViewController {

@IBOutlet weak var emailTextField: UITextField!
@IBOutlet weak var passwordTextField: UITextField!

@IBAction func createAccountAction (_ sender: Any) {
    if emailTextField.text == "" {
        let alertController = UIAlertController(title: "Error", message: "Please enter your email and password", preferredStyle: .alert)

        let defaultAction = UIAlertAction(title: "OK", style: .cancel, handler: nil)
        alertController.addAction(defaultAction)

        present(alertController, animated: true, completion: nil)
    }else {
            Auth.auth().createUser(withEmail: emailTextField.text!, password: passwordTextField.text!) { (user, error) in

                if error == nil {
                    print("You have successfully signed up")
                    //Goes to the Setup page which lets the user take a photo for their profile picture and also chose a username

                    let vc = self.storyboard?.instantiateViewController(withIdentifier: "Home")
                    self.present(vc!, animated: true, completion: nil)
                } else {
                    let alertController = UIAlertController(title: "Error", message: error?.localizedDescription, preferredStyle: .alert)

                    let defaultAction = UIAlertAction(title: "OK", style: .cancel, handler: nil)
                    alertController.addAction(defaultAction)

                    self.present(alertController, animated: true, completion: nil)
我的故事板是这样的

我的错误:


错误发生在代码的何处?如果您熟悉断点,请添加一个“所有异常”断点并再次运行,您将获得更多信息类AppDelegate:UIResponder,UIApplicationLegate{我在我的帖子中添加了一张图片。您的控制台中是否有错误消息?这可能是您的故事板有问题,可能是iOutlets/iActions之间缺少连接。有时,如果您更改故事板,旧的iOutlets/iActions会保留。在右标识检查器中,按右箭头图标可删除“显示连接检查器”并删除任何不必要的iboutlets/IBAction扫描您提供的堆栈跟踪?错误发生在代码中的何处?如果您熟悉断点,请添加一个“所有异常”并再次运行它,您将获得更多信息类AppDelegate:UIResponder,UIApplicationLegate{我在我的帖子中添加了一张图片。您的控制台中是否有错误消息?这可能是您的故事板有问题,可能是iOutlets/iActions之间缺少连接。有时,如果更改故事板,旧的iOutlets/iActions会保留。在右侧的标识检查器中,按向右箭头图标以“显示连接检查器”并删除任何不必要的iboutlets/ibactionsCan是否提供堆栈跟踪?