Instabug/Instabug-iOS

Crash related to UICollectionView

sz-zoli-lateral opened this issue ยท 20 comments

Steps to Reproduce the Problem

When used together with UIPageViewController there is a crash.
It crashes where I set the view controllers:
self.pageViewControl.setViewControllers([self.viewControllers[page]], direction: .forward, animated: true, completion: nil)

2018-01-23 10:37:05.680553+0200 Application[71504:1465646] *** Assertion failure in -[_UIQueuingScrollView _replaceViews:updatingContents:adjustContentInsets:animated:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3698.33.6/_UIQueuingScrollView.m:395 2018-01-23 10:37:05.695046+0200 Application[71504:1465646] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: [views count] == 3' *** First throw call stack: ( 0 CoreFoundation 0x00000001128a012b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x00000001119fdf41 objc_exception_throw + 48 2 CoreFoundation 0x00000001128a52f2 +[NSException raise:format:arguments:] + 98 3 Foundation 0x000000011149ed69 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193 4 UIKit 0x000000010fa91def -[_UIQueuingScrollView _replaceViews:updatingContents:adjustContentInsets:animated:] + 1018 5 UIKit 0x000000010fa95839 -[_UIQueuingScrollView _didScrollWithAnimation:force:] + 1181 6 UIKit 0x000000010fa90e34 -[_UIQueuingScrollView _scrollViewAnimationEnded:finished:] + 92 7 UIKit 0x000000010f15fc53 -[UIAnimator stopAnimation:] + 422 8 UIKit 0x000000010f1603a1 -[UIAnimator _advanceAnimationsOfType:withTimestamp:] + 282 9 QuartzCore 0x0000000112f422b8 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 684 10 QuartzCore 0x0000000113082894 _ZL22display_timer_callbackP12__CFMachPortPvlS1_ + 248 11 CoreFoundation 0x000000011282f899 __CFMachPortPerform + 169 12 CoreFoundation 0x000000011282f7d9 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41 13 CoreFoundation 0x000000011282f741 __CFRunLoopDoSource1 + 465 14 CoreFoundation 0x0000000112827524 __CFRunLoopRun + 2596 15 CoreFoundation 0x0000000112826889 CFRunLoopRunSpecific + 409 16 GraphicsServices 0x00000001171059c6 GSEventRunModal + 62 17 UIKit 0x000000010efce5d6 UIApplicationMain + 159 18 Application 0x0000000109acfca7 main + 55 19 libdyld.dylib 0x000000011468ed81 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

SDK Version

7.8.4
7.7.1 doesn't crash

iOS Version

iOS 11

Device Type

Multiple devices tested

@sz-zoli-lateral I will check it and get back to you soon but I can not see Instabug or InstabugCore in stack trace!!!

I have updated the description and title. I will try to make a sample app that reproduces this issue, but it is hard because we have a complex layout.
Something must have changed in Instabug v7.8, because v7.7.1 doesn't produce a crash or when I remove Instabug completely.

@sz-zoli-lateral Could you integrate again with v7.8 and put a break point on this line of code
self.pageViewControl.setViewControllers([self.viewControllers[page]], direction: .forward, animated: true, completion: nil) and double check that this line is called from mainThread.

@sz-zoli-lateral also could you give the latest version a try ?

I have tried it with the latest version(7.8.4) and it still doesn't help.
I have checked that line and it runs on main thread. I also tried adding a wrapper around it: MainQueue.main.async {}, but it didn't help.

Interestingly when I set the animation to false it didn't crash. Setting Instabug to 7.7.1 also doesn't crash even if animation is set to true.

@sz-zoli-lateral Could you try to disable visual user steps using this method ?
[Instabug setReproStepsMode:IBGUserStepsModeEnabledWithNoScreenshots];

I can confirm that if I disable visual user steps, then the crash doesn't happen.

That's interesting that application crashes because of Instabug and no stack frame exist related to Instabug.
could you give this custom build a try

pod 'Instabug', :git => 'https://github.com/Instabug/Instabug-iOS.git', :branch => 'fixUserSteps'

It doesn't crash with this. It will be available in the next release?

@sz-zoli-lateral are you sure that you used the custom build because it has a typo and i fix it now.

I have used it like this:
pod 'Instabug', :git => 'https://github.com/Instabug/Instabug-iOS.git', :branch => 'fix/useSteps'
Branch: :branch => 'fixUserSteps' didn't work.

@sz-zoli-lateral do you mean by didn't work that it did not fix the crash ?

@Kmohamed by didn't work I meant the git branch name you provided didn't work. After I corrected like above it worked.
The code in the branch worked and fixed the crash.

@sz-zoli-lateral I am so sorry for this conflict but I think you tried the wrong branch could you please give this new one a try and tell me if it fix the crash or not ?

pod 'Instabug', :git => 'https://github.com/Instabug/Instabug-iOS.git', :branch => 'userStepsCrash'

This also fixes the crash.

Thanks a lot ๐Ÿ’ƒ

it will be released very soon

Thank you. You're welcome

@sz-zoli-lateral Fix is released on v7.9.1 Could you give it a try ?

It works