gpt4 book ai didi

ios - Swift 项目因线程 1 : EXC_BAD_ACCESS (code = 1, 地址 = 0x0 而崩溃)

转载 作者:IT王子 更新时间:2023-10-29 05:14:32 25 4
gpt4 key购买 nike

这看起来像是一个糟糕的内存访问,就像试图访问一个不存在的对象。我尝试使用 NSZombie 来查看是否出现了问题,据我所知没有任何问题。它在应用程序委托(delegate)声明时崩溃。

AppDelegate.swift

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate
{
var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]) -> Bool
{
// Override point for customization after app launches
Parse.setApplicationId("removed on purpose", clientKey: "removed on purpose")
PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
PFFacebookUtils.initializeFacebook()

return true
}

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String, annotation: AnyObject?) -> Bool
{
return FBAppCall.handleOpenURL(url, sourceApplication: sourceApplication, withSession: PFFacebookUtils.session())

}

func applicationDidBecomeActive(application: UIApplication)
{
FBAppCall.handleDidBecomeActiveWithSession(PFFacebookUtils.session())
}

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 active state; here you can undo many of the changes made on entering the background.
}

func applicationWillTerminate(application: UIApplication)
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


}

DashboardViewController.swift

import UIKit

class DashboardViewController: UIViewController
{
override func viewDidLoad()
{
super.viewDidLoad()
// Do any additional setup after loading the view
}

}

使用断点我确定它甚至没有通过应用程序委托(delegate)的类声明。我也尝试检查我的 Main.storyboard 文件中的所有类,以确保一切都正确链接,据我所知也是如此。

最佳答案

我今天遇到了同样的问题。从 Xcode 6 beta 6 开始,自动完成建议:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]) -> Bool {}

这会在启动时崩溃并显示 EXC_BAD_ACCESS 和空白屏幕。

一旦 ! 添加到最后一个参数,一切正常:

func application(application: UIApplication,didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]!) -> Bool {}

current documentation ! 也不见了:

optional func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]) -> Bool

关于ios - Swift 项目因线程 1 : EXC_BAD_ACCESS (code = 1, 地址 = 0x0 而崩溃),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25353790/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com