我的应用程序在模拟器上完美运行,它在控制台中没有显示任何警告或错误,但是当我在实际设备上测试我的应用程序时,它在启动应用程序时崩溃。我启用了本地通知服务。我在第一次加载视图时将大型图像文件从服务器存储到我的本地数据库中。但我试图在不存储图像的情况下启动应用程序,仍然无法正常工作。
以下是我得到的崩溃报告。 如果有人知道,请告诉我。 提前谢谢。
Incident Identifier: B92EC717-8391-4F9A-8C34-3CF9AA2E697C
CrashReporter Key: e06a9cfad6f483253b1278ac34a2f38ab1b5cd18
Hardware Model: iPhone7,2
Process: TimeStamp [268]
Path: /private/var/mobile/Containers/Bundle/Application/E87AEE22-E2D8-407F-BDA4-EA626D287C98/TimeStamp.app/TimeStamp
Identifier: SG.TimeStamp
Version: 1 (1.0)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2015-10-02 10:44:13.13 +0530
Launch Time: 2015-10-02 10:44:13.13 +0530
OS Version: iOS 9.0.2 (13A452)
Report Version: 105
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Filtered syslog:
None found
Last Exception Backtrace:
0 CoreFoundation 0x185544f5c 0x185420000 + 1199964
1 libobjc.A.dylib 0x19a13bf80 0x19a134000 + 32640
2 CoreFoundation 0x185544ea4 0x185420000 + 1199780
3 Foundation 0x1863b6a0c 0x186390000 + 158220
4 TimeStamp 0x100049890 -[AppDelegate CopyAndPaste] (AppDelegate.m:104)
5 TimeStamp 0x100048f2c -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:21)
6 UIKit 0x18ab0f184 0x18aa88000 + 553348
7 UIKit 0x18ad37e60 0x18aa88000 + 2817632
8 UIKit 0x18ad3c1a4 0x18aa88000 + 2834852
9 UIKit 0x18ad392e4 0x18aa88000 + 2822884
10 FrontBoardServices 0x18f28b7ec 0x18f264000 + 161772
11 FrontBoardServices 0x18f28bb6c 0x18f264000 + 162668
12 CoreFoundation 0x1854fc5a4 0x185420000 + 902564
13 CoreFoundation 0x1854fc038 0x185420000 + 901176
14 CoreFoundation 0x1854f9d38 0x185420000 + 892216
15 CoreFoundation 0x185428dc0 0x185420000 + 36288
16 UIKit 0x18ab080ac 0x18aa88000 + 524460
17 UIKit 0x18ab02f44 0x18aa88000 + 503620
18 TimeStamp 0x100050220 main (main.m:14)
19 libdyld.dylib 0x19a9668b8 0x19a964000 + 10424
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000019aa831e0 0x19aa68000 + 111072
1 libsystem_pthread.dylib 0x000000019ab4cf0c 0x19ab48000 + 20236
2 libsystem_c.dylib 0x000000019a9f6b78 0x19a994000 + 404344
3 libc++abi.dylib 0x00000001997b93f4 0x1997b8000 + 5108
4 libc++abi.dylib 0x00000001997d5e98 0x1997b8000 + 122520
5 libobjc.A.dylib 0x000000019a13c248 0x19a134000 + 33352
6 libc++abi.dylib 0x00000001997d2f44 0x1997b8000 + 110404
7 libc++abi.dylib 0x00000001997d2b10 0x1997b8000 + 109328
8 libobjc.A.dylib 0x000000019a13c120 0x19a134000 + 33056
9 CoreFoundation 0x0000000185428e68 0x185420000 + 36456
10 UIKit 0x000000018ab080ac 0x18aa88000 + 524460
11 UIKit 0x000000018ab02f44 0x18aa88000 + 503620
12 TimeStamp 0x0000000100050220 main (main.m:14)
13 libdyld.dylib 0x000000019a9668b8 0x19a964000 + 10424
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x000000019aa8459c 0x19aa68000 + 116124
1 libdispatch.dylib 0x000000019a948a04 0x19a934000 + 84484
2 libdispatch.dylib 0x000000019a93793c 0x19a934000 + 14652
Thread 2 name: Dispatch queue: AXBinaryMonitorQueue
Thread 2:
0 libsystem_kernel.dylib 0x000000019aa68c6c 0x19aa68000 + 3180
1 libsystem_platform.dylib 0x000000019ab4297c 0x19ab40000 + 10620
2 libdispatch.dylib 0x000000019a940614 0x19a934000 + 50708
3 AccessibilityUtilities 0x000000018bfe6648 0x18bfc0000 + 157256
4 libdispatch.dylib 0x000000019a9357b0 0x19a934000 + 6064
5 libdispatch.dylib 0x000000019a935770 0x19a934000 + 6000
6 libdispatch.dylib 0x000000019a94175c 0x19a934000 + 55132
7 libdispatch.dylib 0x000000019a939274 0x19a934000 + 21108
8 libdispatch.dylib 0x000000019a935770 0x19a934000 + 6000
9 libdispatch.dylib 0x000000019a943bb0 0x19a934000 + 64432
10 libdispatch.dylib 0x000000019a94334c 0x19a934000 + 62284
11 libsystem_pthread.dylib 0x000000019ab49478 0x19ab48000 + 5240
12 libsystem_pthread.dylib 0x000000019ab49028 0x19ab48000 + 4136
Thread 3:
0 libsystem_kernel.dylib 0x000000019aa83c0c 0x19aa68000 + 113676
1 libsystem_pthread.dylib 0x000000019ab49538 0x19ab48000 + 5432
2 libsystem_pthread.dylib 0x000000019ab49028 0x19ab48000 + 4136
Thread 4:
0 libsystem_kernel.dylib 0x000000019aa83c0c 0x19aa68000 + 113676
1 libsystem_pthread.dylib 0x000000019ab49538 0x19ab48000 + 5432
2 libsystem_pthread.dylib 0x000000019ab49028 0x19ab48000 + 4136
Thread 5:
0 libsystem_kernel.dylib 0x000000019aa83c0c 0x19aa68000 + 113676
1 libsystem_pthread.dylib 0x000000019ab49538 0x19ab48000 + 5432
2 libsystem_pthread.dylib 0x000000019ab49028 0x19ab48000 + 4136
Thread 6:
0 libsystem_kernel.dylib 0x000000019aa83c0c 0x19aa68000 + 113676
1 libsystem_pthread.dylib 0x000000019ab49538 0x19ab48000 + 5432
2 libsystem_pthread.dylib 0x000000019ab49028 0x19ab48000 + 4136
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000147666967
x4: 0x00000001997d6e02 x5: 0x000000016fdd3530 x6: 0x000000000000006e x7: 0x0000000000000f80
x8: 0x0000000008000000 x9: 0x0000000004000000 x10: 0x0000000000000002 x11: 0x0000000000000010
x12: 0x0000000000000000 x13: 0x0000000000000002 x14: 0x0000000000000000 x15: 0x0000030000000300
x16: 0x0000000000000148 x17: 0x0000000000000000 x18: 0x0000000000000000 x19: 0x0000000000000006
x20: 0x00000001a13ee000 x21: 0x000000016fdd3530 x22: 0x0000000147619a60 x23: 0x00000001a13f9b68
x24: 0x0000000000000001 x25: 0xcf00ec12820beef7 x26: 0x0000000147608640 x27: 0x0000000000000000
x28: 0x0000000000000001 fp: 0x000000016fdd3490 lr: 0x000000019ab4cf0c
sp: 0x000000016fdd3470 pc: 0x000000019aa831e0 cpsr: 0x00000000
Binary Images ->
Then there is lot of data that I think might not be of any use.
-(void)CopyAndPaste
{
NSArray *arrpath=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *str=[arrpath objectAtIndex:0];
self.strdbpath=[str stringByAppendingPathComponent:@"time.db"];
NSLog(@"%@",self.strdbpath);
if(![[NSFileManager defaultManager]fileExistsAtPath:self.strdbpath])
{
NSString *localdb=[[NSString alloc]initWithString:[[NSBundle mainBundle]pathForResource:@"time" ofType:@"db"]];
[[NSFileManager defaultManager]copyItemAtPath:localdb toPath:self.strdbpath error:nil];
}
}
答案 0 :(得分:0)
您正在尝试在应用程序启动期间从服务器存储大图像文件。根据您的代码,您尝试在主线程上同步。如果您在任何大量时间内阻止主线程,则用户界面变得无法接受地无响应。为了保持用户界面的响应,iOS包括一个看门狗机制。如果您的应用程序未能及时响应某些用户界面事件(启动,暂停,恢复,终止),则看门狗将终止您的应用程序。要解决此问题,我将异步调用CopyAndPaste:
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){
CopyAndPaste();
});