banchichen / TZImagePickerController

一个支持多选、选原图和视频的图片选择器,同时有预览、裁剪功能,支持iOS6+。 A clone of UIImagePickerController, support picking multiple photos、original photo、video, also allow preview photo and video, support iOS6+
MIT License
8.07k stars 1.86k forks source link

iOS 13.3 反馈 崩溃情况太多。 #1264

Closed Virtue86 closed 4 years ago

Virtue86 commented 4 years ago

提bug前必看 请先回答下列三个问题,否则不允处理,谢谢配合。 1、我最新的Demo是否有这个bug?【如果Demo没问题,请升级新版】 答:最新pod 拉不下来

2、你用的是什么版本?升级到最新版后是否正常? 答:3.2.7

3、是否有改动过我库内部的代码?【如有,请告诉我你改了什么】 答:没有

bug内容描述

我如何复现这个bug?

没复现 截图

截屏2020-01-14下午3 16 32

其它说明 有没有其它要补充的?比如你的初始化TZImagePickerController的代码

Virtue86 commented 4 years ago

最新3.2.9的已经更新,不知道解决了这个问题了么?

banchichen commented 4 years ago

具体的异常信息贴一下,demo能复现吗?

Virtue86 commented 4 years ago

Last Exception Backtrace: 0 CoreFoundation 0x18e826a48 __exceptionPreprocess + 220 (NSException.m:199) 1 libobjc.A.dylib 0x18e54dfa4 objc_exception_throw + 56 (objc-exception.mm:565) 2 CoreFoundation 0x18e87c360 _CFThrowFormattedException + 112 (CFObject.m:1990) 3 CoreFoundation 0x18e710dec -[NSArrayM objectAtIndexedSubscript:] + 212 (NSArrayM.m:302) 4 tangtang 0x105476238 -[TZAlbumPickerController tableView:cellForRowAtIndexPath:] + 280 (TZImagePickerController.m:657) 5 UIKitCore 0x192a7ec04 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 640 (UITableView.m:14483) 6 UIKitCore 0x192a4c2c4 -[UITableView _updateVisibleCellsNow:] + 2608 (UITableView.m:2934) 7 UIKitCore 0x192a6948c -[UITableView layoutSubviews] + 160 (UITableView.m:9240) 8 UIKitCore 0x192d2f3d0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2140 (UIView.m:17028) 9 QuartzCore 0x1952927dc -[CALayer layoutSublayers] + 284 (CALayer.mm:9627) 10 QuartzCore 0x195298958 CA::Layer::layout_if_needed(CA::Transaction) + 480 (CALayer.mm:9501) 11 QuartzCore 0x1952a3578 CA::Layer::layout_and_display_if_needed(CA::Transaction) + 136 (CALayer.mm:2461) 12 QuartzCore 0x1951ebf1c CA::Context::commit_transaction(CA::Transaction*, double) + 304 (CAContextInternal.mm:1992) 13 QuartzCore 0x195215c08 CA::Transaction::commit() + 676 (CATransactionInternal.mm:438) 14 QuartzCore 0x1952165fc CA::Transaction::observer_callback(CFRunLoopObserver, unsigned long, void) + 92 (CATransactionInternal.mm:888) 15 CoreFoundation 0x18e7a3e68 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 32 (CFRunLoop.c:1758) 16 CoreFoundation 0x18e79ed54 CFRunLoopDoObservers + 416 (CFRunLoop.c:1868) 17 CoreFoundation 0x18e79f320 CFRunLoopRun + 1308 (CFRunLoop.c:2910) 18 CoreFoundation 0x18e79eadc CFRunLoopRunSpecific + 464 (CFRunLoop.c:3192) 19 GraphicsServices 0x198724328 GSEventRunModal + 104 (GSEvent.c:2246) 20 UIKitCore 0x192899ae0 UIApplicationMain + 1936 (UIApplication.m:4773) 21 tangtang 0x105160cb4 main + 444 (main.mm:43) 22 libdyld.dylib 0x18e628360 start + 4

Thread 0 name: Thread 0 Crashed: 0 libsystem_kernel.dylib 0x000000018e61dec4 pthread_kill + 8 1 libsystem_pthread.dylib 0x000000018e53d724 pthread_kill$VARIANT$armv81 + 216 (pthread.c:1458) 2 libsystem_c.dylib 0x000000018e48d844 abort + 100 (abort.c:110) 3 libc++abi.dylib 0x000000018e5e67d4 abort_message + 128 (abort_message.cpp:76) 4 libc++abi.dylib 0x000000018e5f3324 std::terminate(void (*)()) + 48 (cxa_handlers.cpp:67) 5 libc++abi.dylib 0x000000018e5f2ed8 __cxa_rethrow + 144 (cxa_exception.cpp:618) 6 libobjc.A.dylib 0x000000018e54e158 objc_exception_rethrow + 40 (objc-exception.mm:604) 7 CoreFoundation 0x000000018e79eb4c CFRunLoopRunSpecific + 576 (CFRunLoop.c:3206) 8 GraphicsServices 0x0000000198724328 GSEventRunModal + 104 (GSEvent.c:2246) 9 UIKitCore 0x0000000192899ae0 UIApplicationMain + 1936 (UIApplication.m:4773) 10 tangtang 0x0000000105160cb4 main + 444 (main.mm:43) 11 libdyld.dylib 0x000000018e628360 start + 4

Virtue86 commented 4 years ago

没有复现到,线上发现的bug。

Virtue86 commented 4 years ago
截屏2020-01-14下午8 25 47 截屏2020-01-14下午8 25 32

上图 这两log 是一个错误吧??

banchichen commented 4 years ago

上面的只是堆栈哈,没有崩溃时的异常内容,比如下面这段,Terminating app due to这一段内容你那有吗?

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndexedSubscript:]: index 2 beyond bounds [0 .. 1]'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff23c7127e __exceptionPreprocess + 350
    1   libobjc.A.dylib                     0x00007fff513fbb20 objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff23d03ab1 _CFThrowFormattedException + 194
    3   CoreFoundation                      0x00007fff23b85749 -[__NSArrayM objectAtIndexedSubscript:] + 169
    4   TZImagePickerController             0x000000010df71fc3 -[TZAlbumPickerController tableView:cellForRowAtIndexPath:] + 435
    5   UIKitCore                           0x00007fff48297462 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 781
    6   UIKitCore                           0x00007fff4826043b -[UITableView _updateVisibleCellsNow:] + 3081
    7   UIKitCore                           0x00007fff4828055f -[UITableView layoutSubviews] + 194
    8   UIKitCore                           0x00007fff485784bd -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2478
    9   QuartzCore                          0x00007fff2b131db1 -[CALayer layoutSublayers] + 255
    10  QuartzCore                          0x00007fff2b137fa3 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 517
    11  QuartzCore                          0x00007fff2b1438da _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 80
    12  QuartzCore                          0x00007fff2b08a848 _ZN2CA7Context18commit_transactionEPNS_11TransactionEd + 324
    13  QuartzCore                          0x00007fff2b0bfb51 _ZN2CA11Transaction6commitEv + 643
    14  QuartzCore                          0x00007fff2b0c04ba _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 76
    15  CoreFoundation                      0x00007fff23bd3867 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    16  CoreFoundation                      0x00007fff23bce2fe __CFRunLoopDoObservers + 430
    17  CoreFoundation                      0x00007fff23bce97a __CFRunLoopRun + 1514
    18  CoreFoundation                      0x00007fff23bce066 CFRunLoopRunSpecific + 438
    19  GraphicsServices                    0x00007fff384c0bb0 GSEventRunModal + 65
    20  UIKitCore                           0x00007fff48092d4d UIApplicationMain + 1621
    21  TZImagePickerController             0x000000010df5dc10 main + 112
    22  libdyld.dylib                       0x00007fff5227ec25 start + 1
    23  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Virtue86 commented 4 years ago

异常内容是一样的

banchichen commented 4 years ago

@Virtue86 你的异常没发全,你只发了First throw call stack下面的部分,上面的呢?

Virtue86 commented 4 years ago

1、 Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.
2、-[__NSArrayM objectAtIndexedSubscript:]: index 5 beyond bounds [0 .. 4]

banchichen commented 4 years ago

cell.model = _albumArr[indexPath.row];数组越界? 有点不可思议...

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _albumArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    TZAlbumCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TZAlbumCell"];
    TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
    cell.albumCellDidLayoutSubviewsBlock = imagePickerVc.albumCellDidLayoutSubviewsBlock;
    cell.albumCellDidSetModelBlock = imagePickerVc.albumCellDidSetModelBlock;
    cell.selectedCountButton.backgroundColor = imagePickerVc.iconThemeColor;
    cell.model = _albumArr[indexPath.row];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    TZPhotoPickerController *photoPickerVc = [[TZPhotoPickerController alloc] init];
    photoPickerVc.columnNumber = self.columnNumber;
    TZAlbumModel *model = _albumArr[indexPath.row];
    photoPickerVc.model = model;
    [self.navigationController pushViewController:photoPickerVc animated:YES];
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
}

你可以试试在调 _albumArr[indexPath.row] 前判断下数组个数保护下

还没人这样反馈过...

Virtue86 commented 4 years ago

加了,只有这样试试了,因为这个崩溃很多。

Kienty commented 4 years ago

image 1588212647015 image 一点击返回就出现崩溃

banchichen commented 4 years ago

@Kienty 参见这个issue哈:https://github.com/banchichen/TZImagePickerController/issues/1151