我遇到了随机崩溃,崩溃日志是:
Incident Identifier: 5B45B5FC-F230-4473-B34E-563347A8F526
CrashReporter Key: 422bae842b3a4768a53a924620fe1361c39417ce
Hardware Model: iPhone6,2
Process: SocialFinancialClient [1340]
Path: /private/var/containers/Bundle/Application/825626A6-84EF-4026-81ED-F2FFD26C62E3/SocialFinancialClient.app/SocialFinancialClient
Identifier: com.tigerEN.TXT
Version: 9e2b846 (4.3.0)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2016-09-12 15:28:28.28 +0800
Launch Time: 2016-09-12 15:28:18.18 +0800
OS Version: iOS 9.3.5 (13G36)
Report Version: 105
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x000000009c3cf3e0
Triggered by Thread: 0
Filtered syslog:
None found
Global Trace Buffer (reverse chronological seconds):
2.067112 CFNetwork 0x0000000182bdd480 TCP Conn 0x14071c990 started
2.091158 CFNetwork 0x0000000182bdd480 TCP Conn 0x14041d700 started
2.506169 CFNetwork 0x0000000182bdbe7c TCP Conn 0x13efd7b00 complete. fd: 40, err: 0
2.506602 CFNetwork 0x0000000182bdd3a8 TCP Conn 0x13efd7b00 event 1. err: 0
2.541005 CFNetwork 0x0000000182bdd480 TCP Conn 0x13efb5830 started
2.612693 CFNetwork 0x0000000182bdbe7c TCP Conn 0x1402a00f0 complete. fd: 25, err: 0
2.613109 CFNetwork 0x0000000182bdd3a8 TCP Conn 0x1402a00f0 event 1. err: 0
2.792192 CFNetwork 0x0000000182b397f0 TCP Conn 0x14011e0e0 starting SSL negotiation
2.792786 CFNetwork 0x0000000182bdbe7c TCP Conn 0x14011e0e0 complete. fd: 17, err: 0
2.794299 CFNetwork 0x0000000182bdd3a8 TCP Conn 0x14011e0e0 event 1. err: 0
2.799656 CFNetwork 0x0000000182b397f0 TCP Conn 0x13efeb720 starting SSL negotiation
2.800391 CFNetwork 0x0000000182bdbe7c TCP Conn 0x13efeb720 complete. fd: 13, err: 0
2.801927 CFNetwork 0x0000000182bdd3a8 TCP Conn 0x13efeb720 event 1. err: 0
2.893070 CFNetwork 0x0000000182bdbe7c TCP Conn 0x140294c70 complete. fd: 11, err: 0
2.894771 CFNetwork 0x0000000182bdd3a8 TCP Conn 0x140294c70 event 1. err: 0
3.545408 CFNetwork 0x0000000182bdd480 TCP Conn 0x13efd7b00 started
3.625399 CFNetwork 0x0000000182bf5d50 HTTP load failed (error code: 89 [1:89])
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000000181bd4158 objc_release + 8
1 libobjc.A.dylib 0x0000000181bbab54 object_cxxDestructFromClass(objc_object*, objc_class*) + 148
2 libobjc.A.dylib 0x0000000181bc6040 objc_destructInstance + 92
3 libobjc.A.dylib 0x0000000181bc60a0 object_dispose + 28
4 CoreFoundation 0x0000000182482efc -[__NSDictionaryM removeAllObjects] + 512
5 UIKit 0x000000018791a884 -[UICollectionViewFlowLayout invalidateLayoutWithContext:] + 264
6 UIKit 0x0000000187845fd8 -[UICollectionViewLayout invalidateLayout] + 132
7 SocialFinancialClient 0x0000000100370244 -[SFCHomeEntranceView loadDatas:] (SFCHomeEntranceView.m:156)
8 SocialFinancialClient 0x0000000100723650 -[SFCHomeHeaderView loadEntrances:] (SFCHomeHeaderView.m:61)
9 SocialFinancialClient 0x00000001005abbc4 -[SFCHomeRecommandViewController didLoadEntranceInfo] (SFCHomeRecommandViewController.m:408)
10 SocialFinancialClient 0x00000001001b408c -[SFCHomeDataProvider updateEntranceInfoByJsonObject:] (SFCHomeDataProvider.m:230)
11 SocialFinancialClient 0x00000001001b6174 __37-[SFCHomeDataProvider fetchEntrances]_block_invoke (SFCHomeDataProvider.m:531)
12 SocialFinancialClient 0x00000001001f310c __54-[SFCHttpRequestManager GET:parmeters:tag:completion:]_block_invoke (SFCHttpRequestManager.m:183)
13 SocialFinancialClient 0x00000001001f2804 __44-[SFCHttpRequestManager request:completion:]_block_invoke (SFCHttpRequestManager.m:106)
14 SocialFinancialClient 0x000000010085a15c __49-[SFCHttpAPIProxy callApiWithRequest:completion:]_block_invoke (SFCHttpAPIProxy.m:49)
15 SocialFinancialClient 0x000000010099b080 __72-[AFURLSessionManagerTaskDelegate URLSession:task:didCompleteWithError:]_block_invoke_2.71 (AFURLSessionManager.m:202)
16 libdispatch.dylib 0x0000000181fa14bc _dispatch_call_block_and_release + 24
17 libdispatch.dylib 0x0000000181fa147c _dispatch_client_callout + 16
18 libdispatch.dylib 0x0000000181fa6b84 _dispatch_main_queue_callback_4CF + 1844
19 CoreFoundation 0x000000018250cd50 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
20 CoreFoundation 0x000000018250abb8 __CFRunLoopRun + 1628
21 CoreFoundation 0x0000000182434c50 CFRunLoopRunSpecific + 384
22 GraphicsServices 0x0000000183d1c088 GSEventRunModal + 180
23 UIKit 0x0000000187722088 UIApplicationMain + 204
24 SocialFinancialClient 0x00000001000e0b4c main (main.m:17)
25 libdyld.dylib 0x0000000181fd28b8 start + 4
似乎在_block_invoke中,在loadDatas
中设置新数据(NSArray类型)之后,应用程序在发布旧数据时崩溃。
我在stackoverflow上找不到类似的问题。有人请帮助我。
我正在使用一个名为SFCHttpRequestManager
的类来包装AFNetworking,这是一个名为SFCHomeDataProvider
的类,用于获取和解析json数据。
在我的SFCHomeRecommandViewController中,我设置了dataProvider并开始获取数据:
- (void)viewDidLoad {
SFCHomeDataProvider *dataProvider = [SFCHomeDataProvider new];
self.dataProvider = dataProvider;
dataProvider.delegate = self;
[self.dataProvider fetchEntrances];
}
在委托方法中,更新视图:
- (void)didLoadEntranceInfo {
[self.headerView loadEntrances:self.dataProvider.entrances];
}
在我的SFCHomeDataProvider中,使用块来获取和解析数据:
- (void)fetchEntrances {
__weak __typeof(self) weakSelf = self;
[[SFCHttpRequestManager sharedInstance] GET:SFCGetHomeEntranceUrl parmeters:nil tag:0 completion:^(SFCHttpResponse *response, id responseObject) {
if (response.error) {
NSLog(@"erro get card infos:%@", response.error);
} else {
[weakSelf updateEntranceInfoByJsonObject:responseObject];
}
}];
}
- (void)updateEntranceInfoByJsonObject:(NSDictionary *)jsonObj {
// ...
self.entrances = newDatas;
if ([self.delegate respondsToSelector:@selector(didLoadEntranceInfo)]) {
[self.delegate didLoadEntranceInfo];
}
// save to db
[self saveEntrance2DB];
}