Skip to content
This repository has been archived by the owner on Jul 16, 2019. It is now read-only.

iOS 10 Crash in GMImagePickerController #54

Open
sfrdx opened this issue Jul 18, 2016 · 6 comments
Open

iOS 10 Crash in GMImagePickerController #54

sfrdx opened this issue Jul 18, 2016 · 6 comments

Comments

@sfrdx
Copy link

sfrdx commented Jul 18, 2016

Specific Details

GMImagePicker is crashing in the most recent version of iOS 10 beta version (beta 3). It is crashing on this line:

[(UIView*)[_navigationController.toolbar.subviews objectAtIndex:0] setAlpha:0.75f]; // URGH - I know!

https://github.com/guillermomuntaner/GMImagePicker/blob/master/GMImagePicker/GMImagePickerController.m#L89

with the error:

GMPhotoPicker[2127:611046] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray'

and indeed if you stop there you find that _navicationController.toolbar.subviews is indeed an empty array.


Xcode Build

Xcode 8 Beta 2

iOS

10.0 Beta 3 (14A5309d)

@sfrdx
Copy link
Author

sfrdx commented Jul 19, 2016

Additional thoughts: it appears this line of code is attempting to duplicate the transparency effect but with a tint option that is slightly different than Apple's method.

Thoughts about removing this line of code and fixing the transparency to be similar to Apple's?

It will change it so that the navigationBar will need a BarTintColor to make it solid, otherwise it will be the same as Apple's background color where the color is faded based on the transparency light/dark on top of it.
This might not be the result users expect but it is closer to what Apple does and there still would be an option to have a solid color as they are getting now.

I do want to note that transparency is currently not working for me on iOS 9.3. All I see is a solid white nav bar if I don't change any custom preferences and a weird ability to see the collection view over top of the status bar. I had to set transparency to NO in my own app to prevent that from happening.
Also I unfortunately don't have any iOS 8 devices left to test on since we dropped iOS 8 so I cannot comment on iOS8 behavior.

@sfrdx
Copy link
Author

sfrdx commented Jul 19, 2016

Currently working on this in our own fork now.

@sakrist
Copy link

sakrist commented Aug 4, 2016

[(UIView*)[_navigationController.toolbar.subviews objectAtIndex:0] setAlpha:0.75f]; // URGH - I know!
crash on

@tneginareb
Copy link

I just comment that line, and it works like a charm!
//[(UIView*)[_navigationController.toolbar.subviews objectAtIndex:0] setAlpha:0.75f]; // URGH - I know!

@lukaszmargielewski
Copy link

It is always recommended to use firstObject instead of [... objectAtIndex:0].
firstObject returns nil when array is empty instead of crashing app.

bboybboy added a commit to bboybboy/GMImagePicker that referenced this issue Mar 3, 2017
@bboybboy
Copy link

bboybboy commented Mar 3, 2017

#74

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants