Ios 启动时显示空白白屏,但预览时显示良好

Ios 启动时显示空白白屏,但预览时显示良好,ios,swift,Ios,Swift,我的档案就是这样 主故事板 import UIKit class ViewController: UIViewController { @IBOutlet weak var pctA: UITextField! @IBOutlet weak var pctF: UITextField! @IBOutlet weak var pctM: UITextField! @IBOutlet weak var maxA: UITextField! @IBOutl

我的档案就是这样

主故事板

import UIKit

class ViewController: UIViewController {


    @IBOutlet weak var pctA: UITextField!
    @IBOutlet weak var pctF: UITextField!
    @IBOutlet weak var pctM: UITextField!
    @IBOutlet weak var maxA: UITextField!
    @IBOutlet weak var maxM: UITextField!
    @IBOutlet weak var maxF: UITextField!
    @IBOutlet weak var ptsF: UITextField!
    @IBOutlet weak var ptsM: UITextField!
    @IBOutlet weak var ptsA: UITextField!
    @IBOutlet weak var creditNum: UITextField!
    @IBOutlet weak var courseTitle: UITextField!
    @IBOutlet weak var bbTFone: UITextField!
    @IBOutlet weak var bbTFtwo: UITextField!
    @IBOutlet weak var bbTFthree: UITextField!
    @IBOutlet weak var bbTFfour: UITextField!
    @IBOutlet weak var bbImgOne: UIImageView!
    @IBOutlet weak var bbImgTwo: UIImageView!
    @IBOutlet weak var bbImgThree: UIImageView!
    @IBOutlet weak var bbImageFour: UIImageView!


class course {

    var percentA:Int
    var percentF:Int
    var percentM:Int
    var maxAssignment:Int
    var maxFinal:Int
    var maxMidterm:Int
    var pointsA:Int
    var pointsF:Int
    var pointsM:Int
    var numofCredits:Int
    var courseName:String


    init (courseName: String, numofCredits: Int, pointsM: Int, pointsF: Int, pointsA: Int, maxMidterm: Int, maxFinal: Int, maxAssignment: Int, percentA: Int, percentF: Int, percentM: Int) {

        self.courseName = courseName
        self.numofCredits = numofCredits
        self.pointsM = pointsM
        self.pointsF = pointsF
        self.pointsA = pointsA
        self.maxMidterm = maxMidterm
        self.maxFinal = maxFinal
        self.maxAssignment = maxAssignment
        self.percentA = percentA
        self.percentF = percentF
        self.percentM = percentM

    }

}



@IBAction func addCourse(sender: AnyObject) {

    let newCourse = course(courseName: courseTitle.text!, numofCredits: Int(creditNum.text!)!, pointsM: Int(creditNum.text!)!, pointsF: Int(creditNum.text!)!, pointsA: Int(creditNum.text!)!, maxMidterm: Int(creditNum.text!)!, maxFinal: Int(creditNum.text!)!, maxAssignment: Int(creditNum.text!)!, percentA: Int(creditNum.text!)!, percentF: Int(creditNum.text!)!, percentM: Int(creditNum.text!)! )


    var courseArray = [newCourse]

    var assignmentPts = ((newCourse.pointsA)/(newCourse.maxAssignment) * newCourse.percentA)

    var midtermPts = ((newCourse.pointsA)/(newCourse.maxAssignment) * newCourse.percentA)

    var finalPts = ((newCourse.pointsA)/(newCourse.maxAssignment) * newCourse.percentA)

    var totalPts = assignmentPts + midtermPts + finalPts



    func appendtoBB() {



        for (var index = 0; index < 4; index++) {

        if bbTFone == nil {

            self.bbTFone.text = courseArray[0].courseName

        } else if (bbTFtwo == nil) {

            self.bbTFtwo.text = courseArray[1].courseName

        } else if (bbTFthree == nil) {

            self.bbTFthree.text = courseArray[2].courseName

        } else {

            self.bbTFfour.text = courseArray[3].courseName

        }

        }


    }



    func courseGrade() {



        if totalPts > 90 {

            bbImgOne.image = UIImage(named: "grade_a")

        } else if totalPts > 80 {

            bbImgTwo.image = UIImage(named: "grade_b")

        } else if totalPts > 70 {

            bbImgTwo.image = UIImage(named: "grade_c")

        } else if totalPts > 60 {

            bbImgTwo.image = UIImage(named: "grade_d")

        } else {

            bbImgTwo.image = UIImage(named: "grade_f")

        }


    }


    appendtoBB()
    courseGrade()


}




override func viewDidLoad() {
    super.viewDidLoad()
    // 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.
}


}
当我模拟我的应用程序时,我在启动时会有一个空白的白色屏幕,而不是在预览中,它会显示我的MainstryBoard作为启动屏幕。我已经将启动屏幕文件基名称定义为:main,将文件序列图像板文件基名称定义为:main。此外,当应用程序运行时,我会生成一个警告,上面写着“线程1:信号SIGABRT”


谁能给我指一下正确的方向吗?谢谢

在故事板中是否将ViewController设置为初始ViewController?是的,它设置为初始ViewController检查您与插座的连接,确保它们仍然正确。如果更改了名称,则必须删除该连接。将助手编辑器与connections属性视图结合使用。当您获得SIGABRT时,控制台中是否输出了任何内容?
import UIKit

  @UIApplicationMain
  class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.
    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 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:.
}




}