Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 10 Beta SDK - [UIDeviceRGBColor countByEnumeratingWithState:objects:count:]: unrecognized selector

Tags:

ios

ios10

sdk

beta

When our iOS application is compiled on iOS 10 Developer Preview SDK, when launching one of the first view controllers of the application, the application crashes with this exception :

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDeviceRGBColor countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x17adb5a0'  
*** First throw call stack:  
(0x23c9b91b 0x23436e17 0x24474da3 0x24474f5f 0x24447e81 0x24446f25 0x286c8a0b 0x2857baa3 0x2834effb 0x28214a1f 0x28214971 0x28aa9ec1 0x28560d01 0x285846e5 0x28586d65 0x28223541 0x28586ca9 0x28586f91 0x2830ddb9 0x28586fcf 0x1c13b3 0x1beb89 0x1bf927 0x244c6655 0x23c5e58f 0x23c5e1c1 0x23c5c00d 0x23bab229 0x23bab015 0x2519bac9 0x2827d189 0xe3b65 0x23853873)  
libc++abi.dylib: terminating with uncaught exception of type NSException  

In the code of our application, this selector of UIDeviceRGBColor is never called.

Does someone have the same problem ? Is it a bug of iOS 10 Beta ?

When compiled with iOS 10 Beta SDK, the problem occurs as well on devices running on iOS 10 Beta as on iOS 9.

The problem does not appear (not on iOS 10, not on iOS 9) when the application is compiled with iOS 9 SDK

Thank you.

Best regards.

like image 560
geolives Avatar asked Jun 16 '16 07:06

geolives


1 Answers

In case your are using interface files like Xib and Nib for your views, refer to my answer in this question

Quoted from that question:

When I try to compile and run my project with the same configuration (XCode 8 beta 6, iOS 10 SDK), I encountered a similar issue, except that my error message was:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDeviceRGBColor length]: unrecognized selector sent to instance 0x600000479280'

And I noticed that this issue only occurs when the view is init by using interface files, i.e. Xib and Nib. I solved this issue by:

  1. Open your interface file, in the right panel, navigate to the File Inspector tab.

  2. Change the attribute highlighted to "iOS 7.0 and Later" (or whatever iOS version later) enter image description here

Then compile and run your project again, this should fix your issue, though I am not sure about the reason behind this.

like image 73
alanlo Avatar answered Oct 21 '22 11:10

alanlo