Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000079706f70
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000000182ae1b90 0x182ac8000 + 105360
1 MyApp 0x0000000100064b28 0x100034000 + 199464
2 MyApp 0x0000000100064a0c 0x100034000 + 199180
3 MyApp 0x000000010004434c 0x100034000 + 66380
4 UIKit 0x00000001885c8c40 0x1885b4000 + 85056
5 UIKit 0x00000001885c8844 0x1885b4000 + 84036
6 UIKit 0x000000018870daf4 0x1885b4000 + 1415924
7 UIKit 0x000000018870d8f8 0x1885b4000 + 1415416
8 UIKit 0x000000018870d730 0x1885b4000 + 1414960
9 UIKit 0x0000000188710698 0x1885b4000 + 1427096
10 UIKit 0x00000001885d75b4 0x1885b4000 + 144820
11 UIKit 0x000000018871246c 0x1885b4000 + 1434732
12 UIKit 0x0000000188710f70 0x1885b4000 + 1429360
13 UIKit 0x00000001885e1374 0x1885b4000 + 185204
14 UIKit 0x00000001885e10e8 0x1885b4000 + 184552
15 UIKit 0x00000001885d0f14 0x1885b4000 + 118548
16 UIKit 0x00000001885d013c 0x1885b4000 + 115004
17 UIKit 0x00000001885cf7e8 0x1885b4000 + 112616
18 UIKit 0x000000018864149c 0x1885b4000 + 578716
19 MyApp 0x0000000100050048 0x100034000 + 114760
20 UIKit 0x000000018863e9c0 0x1885b4000 + 567744
21 UIKit 0x000000018886e184 0x1885b4000 + 2859396
22 UIKit 0x00000001888725f0 0x1885b4000 + 2876912
23 UIKit 0x000000018886f764 0x1885b4000 + 2864996
24 FrontBoardServices 0x0000000184e0b7ac 0x184de4000 + 161708
25 FrontBoardServices 0x0000000184e0b618 0x184de4000 + 161304
26 FrontBoardServices 0x0000000184e0b9c8 0x184de4000 + 162248
27 CoreFoundation 0x000000018342109c 0x183340000 + 921756
28 CoreFoundation 0x0000000183420b30 0x183340000 + 920368
29 CoreFoundation 0x000000018341e830 0x183340000 + 911408
30 CoreFoundation 0x0000000183348c50 0x183340000 + 35920
31 UIKit 0x000000018863794c 0x1885b4000 + 538956
32 UIKit 0x0000000188632088 0x1885b4000 + 516232
33 MyApp 0x000000010004820c 0x100034000 + 82444
34 libdyld.dylib 0x0000000182ee68b8 0x182ee4000 + 10424
我不知道从哪里开始,因为在我的情况下,我的应用程序工作正常。我真的需要帮助。
更新: 所以我尝试重新符号化日志,这就是我得到的
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000000182ae1b90 objc_msgSend + 16
1 MyApp 0x0000000100064b28 -[DBManager copyDatabaseIntoDocumentsDirectory] (DBManager.m:56)
2 MyApp 0x0000000100064a0c -[DBManager initWithDatabaseFilename:] (DBManager.m:43)
3 MyApp 0x000000010004434c -[DoorTalkViewController viewDidLoad] (DoorTalkViewController.mm:133)
4 UIKit 0x00000001885c8c40 -[UIViewController loadViewIfRequired] + 996
5 UIKit 0x00000001885c8844 -[UIViewController view] + 28
6 UIKit 0x000000018870daf4 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 488
7 UIKit 0x000000018870d8f8 -[UITabBarController transitionFromViewController:toViewController:] + 68
8 UIKit 0x000000018870d730 -[UITabBarController _setSelectedViewController:] + 404
9 UIKit 0x0000000188710698 -[UITabBarController setSelectedViewController:] + 252
10 UIKit 0x00000001885d75b4 +[UIView(Animation) performWithoutAnimation:] + 80
11 UIKit 0x000000018871246c -[UITabBarController _selectDefaultViewControllerIfNecessaryWithAppearanceTransitions:] + 332
12 UIKit 0x0000000188710f70 -[UITabBarController viewWillAppear:] + 200
13 UIKit 0x00000001885e1374 -[UIViewController _setViewAppearState:isAnimating:] + 628
14 UIKit 0x00000001885e10e8 -[UIViewController __viewWillAppear:] + 156
15 UIKit 0x00000001885d0f14 -[UIView(Hierarchy) _willMoveToWindow:withAncestorView:] + 596
16 UIKit 0x00000001885d013c -[UIView(Internal) _addSubview:positioned:relativeTo:] + 444
17 UIKit 0x00000001885cf7e8 -[UIWindow addRootViewControllerViewIfPossible] + 664
18 UIKit 0x000000018864149c -[UIWindow setRootViewController:] + 1076
19 MyApp 0x0000000100050048 -[idoubs2AppDelegate application:didFinishLaunchingWithOptions:] (idoubs2AppDelegate.mm:374)
20 UIKit 0x000000018863e9c0 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 400
21 UIKit 0x000000018886e184 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2904
22 UIKit 0x00000001888725f0 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1684
23 UIKit 0x000000018886f764 -[UIApplication workspaceDidEndTransaction:] + 168
24 FrontBoardServices 0x0000000184e0b7ac __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36
25 FrontBoardServices 0x0000000184e0b618 -[FBSSerialQueue _performNext] + 168
26 FrontBoardServices 0x0000000184e0b9c8 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
27 CoreFoundation 0x000000018342109c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
28 CoreFoundation 0x0000000183420b30 __CFRunLoopDoSources0 + 540
29 CoreFoundation 0x000000018341e830 __CFRunLoopRun + 724
30 CoreFoundation 0x0000000183348c50 CFRunLoopRunSpecific + 384
31 UIKit 0x000000018863794c -[UIApplication _run] + 460
32 UIKit 0x0000000188632088 UIApplicationMain + 204
33 MyApp 0x000000010004820c main (main.m:25)
34 libdyld.dylib 0x0000000182ee68b8 start + 4
更新 我从教程
获得的CopyDatabaseIntoDocumentsDirectory方法
-(void)copyDatabaseIntoDocumentsDirectory{
// Check if the database file exists in the documents directory.
NSString *destinationPath = [self.documentsDirectory stringByAppendingPathComponent:self.databaseFilename];
if (![[NSFileManager defaultManager] fileExistsAtPath:destinationPath]) {
// The database file does not exist in the documents directory, so copy it from the main bundle now.
NSString *sourcePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:self.databaseFilename];
NSError *error;
[[NSFileManager defaultManager] copyItemAtPath:sourcePath toPath:destinationPath error:&error];
// Check if any error occurred during copying and display it.
if (error != nil) {
NSLog(@"%@", [error localizedDescription]);
}
}
}
第56行是NSLog(@"%@", [error localizedDescription]);
答案 0 :(得分:0)
你可以检查一下,请将错误的初始化更新为:
NSError *error = nil;
我怀疑实际上没有错误,但是它指向了垃圾数据的某个地址。因此条件error != nil
将返回true
,但无法识别选择器localizedDescription
。