My app closes in ios6 with UIAppearance setTintColor
Asked Answered
E

3

5

my app is running with no problem in ios 7 but when i run it in ios 6 it goes down. The report is:

2013-10-17 22:58:45.509 Santarem Guide[606:c07] -[_UIAppearance setTintColor:]: unrecognized selector sent to instance 0xa149390
2013-10-17 22:58:45.510 Santarem Guide[606:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_UIAppearance setTintColor:]: unrecognized selector sent to instance 0xa149390'
*** First throw call stack:
(0x29d8012 0x1951e7e 0x2a634bd 0x29c7bbc 0x29c794e 0x7ade 0x8967b7 0x896da7 0x897fab 0x8a9315 0x8aa24b 0x89bcf8 0x2e69df9 0x2e69ad0 0x294dbf5 0x294d962 0x297ebb6 0x297df44 0x297de1b 0x8977da 0x89965c 0x2dfd 0x20fa725)
libc++abi.dylib: terminate called throwing an exception
(lldb) 

Does anyone had this problem?

In my App Delegate i have [[UIView appearance] setTintColor:[UIColor whiteColor]]; and if i turn it this to [[UIView appearance] setBackgroundColor:[UIColor whiteColor]]; i get a new error that is

2013-10-17 23:08:58.310 Santarem Guide[659:c07] -[UITableView setTintColor:]: unrecognized selector sent to instance 0x1138aa00

and all gets white.

Edging answered 17/10, 2013 at 22:10 Comment(3)
Some methods are depreciated between SDK's version, check if the method are available before use.Oilskin
How can i see which one is deprecated?Edging
if([[UIView appearance] respondsToSelector:@selector(setTintColor:)]){ [[UIView appearance] setTintColor:[UIColor whiteColor]]; } with this.Oilskin
W
10

You should check if the method is available before use it.

if ([[UIView appearance] respondsToSelector:@selector(setTintColor:)]) {
    [[UIView appearance] setTintColor:[UIColor whiteColor]];
}
Writer answered 17/10, 2013 at 22:17 Comment(0)
U
2

Check whether target device is iOS7-compatible:

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
    [[UIView appearance] setTintColor:[UIColor whiteColor]];
}
Unprejudiced answered 9/5, 2014 at 9:12 Comment(0)
E
1

So i figured out, i had several errors because i was using some code that ios6 does not support. I had to put

if (SYSTEM_VERSION_LESS_THAN(@"7.0")) {
        // code here 
} else { 
   code here
}

In many parts of the project so he could run in ios6. Another problem was i was also using my map with 3D.

Thanks for the replies

In this case you have to include following macro in the class or global in .pch-file

#define SYSTEM_VERSION_LESS_THAN(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
Edging answered 17/10, 2013 at 22:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.