它看起来像一个糟糕的内存访问,就像尝试访问不存在的对象一样。我尝试使用NSZombie看看是否有什么东西出现,据我所知,没有做到。它正在申请代表的声明中崩溃。
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
}
}
使用断点我已经确定它甚至没有通过app委托的类声明。我尝试检查Main.storyboard文件中的所有类,以确保所有内容都正确链接,据我所知。
答案 0 :(得分:14)
我今天遇到了同样的问题。从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
答案 1 :(得分:0)
使用Xcode 6.1:
尝试
PFAnalytics.trackAppOpenedWithLaunchOptionsInBackground(launchOptions, block: nil)
而不是
PFAnalytics.trackAppOpenedWithLaunchOptions()
答案 2 :(得分:0)
解决方案。
通过修复以下代码解决了问题。
在所有方法签名中,替换:
application: UIApplication
使用:
application: UIApplication!
在application:didFinishLaunchingWithOptions:
中,替换:
launchOptions: [NSObject : AnyObject]
使用:
launchOptions: NSDictionary!