我最近升级到Xcode 11.2.1和最新的iOS 13.2.2,现在出现错误
EXC_BAD_ACCESS(代码= 1,地址= 0x30)
有错误的行从forEach循环中被调用了约2000次。
如果我在错误的行上设置断点并以调试状态运行代码,则不会发生崩溃
如果我在错误声明前添加打印print("Hi mom")
,则不会发生错误
我非常确定,添加打印语句只会绕过实际错误,并且可能会在以后或在不同的iOS设置中或以较低的频率发生。
else if actionFigureSpecificsCoreData != nil {
coreDataUpdateDate = self.actionFigureSpecificsCoreData!.updateDate! as Date
// WARNING: Not saving here intentionally as no actual changes are being made - see save functions
// WARNING: dont create the iCloud record at this point otherwise the save context may error for null values create the record
// if the coreData record exists without all defaults and the iCloud record doesn't exist, create the iCloud record.
// case where device was off-line
if self.isActionFigureSpecificsCoreDataDefaultValues() == false {
// #if DEBUG
// print("No iCloud record for Saving from non-default coreData \(self.actionFigureSpecificsGlobalUniqueId) on \(kActionFigureSpecificsRecord)")
// #endif
isCloudSaveNeeded = true
shouldSetCloudDataToCore = true
}
}
// if both core data and cloud are nil, set the core data record
else {
<<<<<<<<-------------crashes on the next line unless I add in a print statement ----------------->>>>>>>
self.actionFigureSpecificsCoreData = ActionFigureSpecificsCoreData(context: SharedData.sharedInstance.managedObjectContext!)
self.actionFigureSpecificsCoreData!.actionFigureRecordName = self.actionFigureGlobalUniqueId
// want it and have it are set to defaults by core data
self.actionFigureSpecificsCoreData!.updateDate = NSDate() as Date
// all other values are set to the database defaults
}
class SharedData {
// core data
var appDelegate: AppDelegate!
var managedObjectContext: NSManagedObjectContext!
// in app purchases
var isRemoveAdInAppPurchase: Bool = false
class var sharedInstance: SharedData {
struct Singleton {
static let instance = SharedData()
}
return Singleton.instance
}
init() {
// set core data database properties
//self.appDelegate = UIApplication.shared.delegate as! AppDelegate
self.appDelegate = UIApplication.shared.delegate as? AppDelegate
self.managedObjectContext = self.appDelegate.persistentContainer.viewContext
}
苹果崩溃日志的顶部
{"app_name":"My Toy Chest","timestamp":"2019-11-13 07:18:28.55 -0800","app_version":"6.037","slice_uuid":"6ae4b8f2-ac29-3b31-87a8-3ebf4634251f","adam_id":1217665205,"build_version":"1","bundleID":"com.LightningBrainGames.My-Toy-Chest","share_with_app_devs":false,"is_first_party":false,"bug_type":"109","os_version":"iPhone OS 13.2.2 (17B102)","incident_id":"41DB21DA-774E-42C1-B340-425689BBCB6A","name":"My Toy Chest"}
Incident Identifier: 41DB21DA-774E-42C1-B340-425689BBCB6A
CrashReporter Key: 43b464acde1fb0315e3dc82db0fb5a581b250135
Hardware Model: xxx
Process: My Toy Chest [478]
Path: /private/var/containers/Bundle/Application/5E9921A8-1895-4880-864B-F1D2A0DCDE3B/My Toy Chest.app/My Toy Chest
Identifier: com.LightningBrainGames.My-Toy-Chest
Version: 1 (6.037)
AppStoreTools: 11B48b
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.LightningBrainGames.My-Toy-Chest [590]
Date/Time: 2019-11-13 07:18:28.0713 -0800
Launch Time: 2019-11-13 07:18:18.5049 -0800
OS Version: iPhone OS 13.2.2 (17B102)
Release Type: User
Baseband Version: n/a
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000018cf8fec4 __pthread_kill + 8
1 libsystem_pthread.dylib 0x000000018ceab774 pthread_kill$VARIANT$mp + 112
2 libsystem_c.dylib 0x000000018cdff844 abort + 100
3 libsystem_malloc.dylib 0x000000018ce98b80 _malloc_put + 0
4 libsystem_malloc.dylib 0x000000018ce98df4 malloc_zone_error + 100
5 libsystem_malloc.dylib 0x000000018ce84044 szone_free + 452
6 CoreFoundation 0x000000018d1bd468 __CFBasicHashDrain + 420
7 CoreData 0x0000000191a475ec -[NSManagedObjectContext+ 71148 (_NSInternalChangeProcessing) _processRecentChanges:] + 832
8 CoreData 0x0000000191b746d0 _performRunLoopAction + 368
9 CoreFoundation 0x000000018d114c2c __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
10 CoreFoundation 0x000000018d10fb18 __CFRunLoopDoObservers + 416
11 CoreFoundation 0x000000018d1100e4 __CFRunLoopRun + 1308
12 CoreFoundation 0x000000018d10f8a0 CFRunLoopRunSpecific + 464
13 GraphicsServices 0x0000000197067328 GSEventRunModal + 104
14 UIKitCore 0x0000000191200740 UIApplicationMain + 1936
15 My Toy Chest 0x00000001001f95e4 0x1001f4000 + 21988
16 libdyld.dylib 0x000000018cf9a360 start + 4```