【问题标题】:IOS: Build Succeed and then get Thread 1: signal SIGABRT on Xcode 9IOS:构建成功然后获取线程 1:Xcode 9 上的信号 SIGABRT
【发布时间】:2018-08-30 10:56:12
【问题描述】:

我最近正在开发一个构建 IOS 应用程序的 uni 项目,在构建入门屏幕期间,该项目构建良好,但之后立即抛出错误。

如果有人能告诉我到底出了什么问题,我将不胜感激。

这是应用程序委托和视图控制器代码:

应用委托:

导入 UIKit 导入 Firebase 导入 Firebase 数据库 导入 MSAL

@UIApplicationMain 类 AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


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

    //Sadi added some code snippets here for the App Tutorial
    window = UIWindow(frame: UIScreen.main.bounds)

    let storyBoard = UIStoryboard(name: "Main", bundle: nil)
    var initialViewController = storyBoard.instantiateViewController(withIdentifier: "Onboarding")

    let userDefaults = UserDefaults.standard
    if userDefaults.bool(forKey: "onboardingComplete") {
        initialViewController = storyBoard.instantiateViewController(withIdentifier: "Mainapp")
    }

    window?.rootViewController = initialViewController
    window?.makeKeyAndVisible()


    return true
}

视图控制器:

导入 UIKit 导入 PaperOnboarding

类 ApptutorialViewController: UIViewController, PaperOnboardingDataSource, PaperOnboardingDelegate {

@IBOutlet weak var onboardingView: OnboardingView!

@IBOutlet weak var getStartedButton: UIButton!

override func viewDidLoad() {
    super.viewDidLoad()
    onboardingView.dataSource = self
    onboardingView.delegate = self

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

func onboardingItemsCount() -> Int {
    return 6
}


func onboardingItem(at index: Int) -> OnboardingItemInfo {


    return [
        OnboardingItemInfo(informationImage: #imageLiteral(resourceName: "logo"),
                           title: "Welcome to SpiderByte!",
                           description: "Please take a few minutes to learn about the features of the app",
                           pageIcon: #imageLiteral(resourceName: "active"),
                           color: UIColor.red,
                           titleColor: UIColor.white,
                           descriptionColor: UIColor.white,
                           titleFont: UIFont.init(name: "AvenirNext-Bold", size: 24)!,
                           descriptionFont: UIFont.init(name: "AvenirNext-Regular", size: 10)!),

        OnboardingItemInfo(informationImage: #imageLiteral(resourceName: "slide"),
                           title: "Navigate around the application",
                           description: "Swipe to switch between Announcements, Events and Personal Information",
                           pageIcon: #imageLiteral(resourceName: "active"),
                           color: UIColor.blue,
                           titleColor: UIColor.white,
                           descriptionColor: UIColor.white,
                           titleFont: UIFont.init(name: "AvenirNext-Bold", size: 24)!,
                           descriptionFont: UIFont.init(name: "AvenirNext-Regular", size: 18)!),

        OnboardingItemInfo(informationImage: #imageLiteral(resourceName: "lock"),
                           title: "Login with your K-number",
                           description: "You can log in with your existing email, using k-number@kcl.ac.uk",
                           pageIcon: #imageLiteral(resourceName: "active"),
                           color: UIColor.cyan,
                           titleColor: UIColor.white,
                           descriptionColor: UIColor.white,
                           titleFont: UIFont.init(name: "AvenirNext-Bold", size: 24)!,
                           descriptionFont: UIFont.init(name: "AvenirNext-Regular", size: 18)!),

        OnboardingItemInfo(informationImage: #imageLiteral(resourceName: "bullhorn"),
                           title: "Announcements",
                           description: "You can click on each announcement to see more detail",
                           pageIcon: #imageLiteral(resourceName: "active"),
                           color: UIColor.blue,
                           titleColor: UIColor.white,
                           descriptionColor: UIColor.white,
                           titleFont: UIFont.init(name: "AvenirNext-Bold", size: 24)!,
                           descriptionFont: UIFont.init(name: "AvenirNext-Regular", size: 18)!),

        OnboardingItemInfo(informationImage: #imageLiteral(resourceName: "calendar"),
                           title: "Calendar",
                           description: "You can click on dates to see more details about events on that day",
                           pageIcon: #imageLiteral(resourceName: "active"),
                           color: UIColor.blue,
                           titleColor: UIColor.white,
                           descriptionColor: UIColor.white,
                           titleFont: UIFont.init(name: "AvenirNext-Bold", size: 24)!,
                           descriptionFont: UIFont.init(name: "AvenirNext-Regular", size: 18)!),

        OnboardingItemInfo(informationImage: #imageLiteral(resourceName: "settings"),
                           title: "Settings",
                           description: "You can click on settings tab to see personal information and application details",
                           pageIcon: #imageLiteral(resourceName: "active"),
                           color: UIColor.blue,
                           titleColor: UIColor.white,
                           descriptionColor: UIColor.white,
                           titleFont: UIFont.init(name: "AvenirNext-Bold", size: 24)!,
                           descriptionFont: UIFont.init(name: "AvenirNext-Regular", size: 18)!)
        ][index]
}


//    func onboardingConfigurationItem(_: OnboardingContentViewItem, index _: Int) {
//        <#code#>
//    }

func onboardingWillTransitonToIndex(_ index: Int) {
    if index == 1 {
        if self.getStartedButton.alpha == 1 {
            UIView.animate(withDuration: 0.2, animations: {
                self.getStartedButton.alpha = 0
            })
        }

    }
}

func onboardingDidTransitonToIndex(_ index: Int) {
    if index == 5 {
        UIView.animate(withDuration: 0.4, animations: {
            self.getStartedButton.alpha = 1
        })
    }
}

@IBAction func gotStarted(_ sender: Any) {
    let userDefaults = UserDefaults.standard
    userDefaults.set(true, forKey: "onboardingComplete")
    userDefaults.synchronize()
}

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

}

【问题讨论】:

  • 您的 App delgate 和第一个视图控制器的代码?
  • 设置异常断点以获取更多信息。堆栈跟踪比这个汇编程序清单更有意义。
  • 请不要发截图,发文字。
  • Appologies ,我对 Stack Overflow 很陌生,所以仍然在网站的图片上传器中找到自己的方式

标签: ios xcode


【解决方案1】:

您没有将 intialViewController 声明为您的自定义类:

var initialViewController = storyBoard.instantiateViewController(withIdentifier: “Onboarding”) as! UIViewController // change to your ViewController class.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-02
    • 2015-02-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多