My app is crashing when it come to following code that is present below:
[cell.imgViewItem setImageWithURL:imageURL placeholderImage:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
NSLog(#"Finished");
} usingActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
Below is the log trace:
2014-09-23 14:11:05.353 SmartSwipe[2834:60b] -[UIImageView sd_cancelImageLoadOperationWithKey:]: unrecognized selector sent to instance 0x79c56ce0
2014-09-23 14:11:05.502 SmartSwipe[2834:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView sd_cancelImageLoadOperationWithKey:]: unrecognized selector sent to instance 0x79c56ce0'
*** First throw call stack:
(
0 CoreFoundation 0x034031e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x031808e5 objc_exception_throw + 44
2 CoreFoundation 0x034a0243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x033f350b ___forwarding___ + 1019
4 CoreFoundation 0x033f30ee _CF_forwarding_prep_0 + 14
5 SmartSwipe 0x0011c1a8 -[UIImageView(WebCache) sd_cancelCurrentImageLoad] + 56
6 SmartSwipe 0x00119744 -[UIImageView(WebCache) sd_setImageWithURL:placeholderImage:options:progress:completed:] + 276
7 SmartSwipe 0x0009cc18 -[UIImageView(UIActivityIndicatorForSDWebImage) setImageWithURL:placeholderImage:options:progress:completed:usingActivityIndicatorStyle:] + 504
8 SmartSwipe 0x0009c875 -[UIImageView(UIActivityIndicatorForSDWebImage) setImageWithURL:placeholderImage:completed:usingActivityIndicatorStyle:] + 229
9 SmartSwipe 0x0003f994 -[QuickScanViewController collectionView:cellForItemAtIndexPath:] + 948
10 UIKit 0x02395b30 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 257
11 UIKit 0x02397775 -[UICollectionView _updateVisibleCellsNow:] + 4730
12 UIKit 0x0239b65f -[UICollectionView layoutSubviews] + 265
13 UIKit 0x01dbe964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
14 libobjc.A.dylib 0x0319282b -[NSObject performSelector:withObject:] + 70
15 QuartzCore 0x007a745a -[CALayer layoutSublayers] + 148
16 QuartzCore 0x0079b244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
17 QuartzCore 0x0079b0b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
18 QuartzCore 0x007017fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
19 QuartzCore 0x00702b85 _ZN2CA11Transaction6commitEv + 393
20 QuartzCore 0x00703258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
21 CoreFoundation 0x033cb36e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
22 CoreFoundation 0x033cb2bf __CFRunLoopDoObservers + 399
23 CoreFoundation 0x033a9254 __CFRunLoopRun + 1076
24 CoreFoundation 0x033a89d3 CFRunLoopRunSpecific + 467
25 CoreFoundation 0x033a87eb CFRunLoopRunInMode + 123
26 GraphicsServices 0x03f345ee GSEventRunModal + 192
27 GraphicsServices 0x03f3442b GSEventRun + 104
28 UIKit 0x01d4ff9b UIApplicationMain + 1225
29 SmartSwipe 0x001105bd main + 141
30 libdyld.dylib 0x04ec5701 start + 1
31 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Please help me, I am struggling with it. Thanks in advance.
You have written a method sd_setImageWithURL which gets called, and that method calls sd_cancelCurrentImageLoad for an UIImageView* that doesn't support the call. Check you source code where you implement sd_cancelCurrentImageLoad and what it does.
Please add SDWebImage framework in you project.
You can do so by using cocoapods, use 'pod "SDWebImage"' in the pod file.
Related
I am trying to implement Google SignIn in my iOS project and getting runtime error at line:
GIDSignIn.sharedInstance().clientID = "mysecrectkey.apps.googleusercontent.com"
in AppDelegate. Error I am getting is something like below. I followed each step which is mentioned in following link and still no luck.
http://www.theappguruz.com/blog/integrate-google-signin-sdk-in-ios-application-using-swift
I tried adding -ObjC in Other Linker Flags section as well. Please help me to figure this out. Thanks
2016-10-09 17:16:57.754 GoogleLoginTest1[8996:611837] -[__NSDictionaryI gtm_httpArgumentsString]: unrecognized selector sent to instance 0x618000071a80
2016-10-09 17:16:57.758 GoogleLoginTest1[8996:611837] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI gtm_httpArgumentsString]: unrecognized selector sent to instance 0x618000071a80'
*** First throw call stack:
(
0 CoreFoundation 0x000000010ce2234b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010c46621e objc_exception_throw + 48
2 CoreFoundation 0x000000010ce91f34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010cda7c15 ___forwarding___ + 1013
4 CoreFoundation 0x000000010cda7798 _CF_forwarding_prep_0 + 120
5 GoogleLoginTest1 0x000000010bb4272e -[GSDK_GTMSessionFetcherSessionDelegateDispatcher .cxx_destruct] + 11318
6 GoogleLoginTest1 0x000000010bb44551 -[GSDK_GTMSessionFetcherSessionDelegateDispatcher .cxx_destruct] + 19033
7 GoogleLoginTest1 0x000000010bb43fc4 -[GSDK_GTMSessionFetcherSessionDelegateDispatcher .cxx_destruct] + 17612
8 GoogleLoginTest1 0x000000010bb223ed _TFC16GoogleLoginTest111AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryVSC29UIApplicationLaunchOptionsKeyP____Sb + 685
9 GoogleLoginTest1 0x000000010bb22594 _TToFC16GoogleLoginTest111AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryVSC29UIApplicationLaunchOptionsKeyP____Sb + 180
10 UIKit 0x000000010da4068e -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 290
11 UIKit 0x000000010da42013 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4236
12 UIKit 0x000000010da483b9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731
13 UIKit 0x000000010da45539 -[UIApplication workspaceDidEndTransaction:] + 188
14 FrontBoardServices 0x00000001131ac76b __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
15 FrontBoardServices 0x00000001131ac5e4 -[FBSSerialQueue _performNext] + 189
16 FrontBoardServices 0x00000001131ac96d -[FBSSerialQueue _performNextFromRunLoopSource] + 45
17 CoreFoundation 0x000000010cdc7311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
18 CoreFoundation 0x000000010cdac59c __CFRunLoopDoSources0 + 556
19 CoreFoundation 0x000000010cdaba86 __CFRunLoopRun + 918
20 CoreFoundation 0x000000010cdab494 CFRunLoopRunSpecific + 420
21 UIKit 0x000000010da43db6 -[UIApplication _run] + 434
22 UIKit 0x000000010da49f34 UIApplicationMain + 159
23 GoogleLoginTest1 0x000000010bb24cdf main + 111
24 libdyld.dylib 0x000000010fc4d68d start + 1
25 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
have you added Other linker flag : -OjcC
I'm developing an app that uses SQLITE and works perfectly on Iphone 6plus simulator but crash on Iphone6 simulator and also on Iphone5. I'm not sure what's the problem. Can anyone help me with that?
This is the debug error that I'm getting from Xcode
*** Terminating app due to uncaught exception 'NSRangeException', reason:
*** -[__NSArrayM objectAtIndex:]: index 9223372036854775807 beyond bounds [0 .. 10]'
*** First throw call stack:
(
0 CoreFoundation 0x000000010492ae65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001043a3deb objc_exception_throw + 48
2 CoreFoundation 0x000000010480e404 -[__NSArrayM objectAtIndex:] + 212
3 ILFCalc 0x0000000103d85cf8 -[EditInfoViewController loadInfoToEdit] + 424
4 ILFCalc 0x0000000103d83f76 -[EditInfoViewController viewDidLoad] + 1174
5 UIKit 0x0000000104e6df98 -[UIViewController loadViewIfRequired] + 1198
6 UIKit 0x0000000104e73f4f -[UIViewController __viewWillAppear:] + 120
7 UIKit 0x0000000104ea3e44 -[UINavigationController _startCustomTransition:] + 1203
8 UIKit 0x0000000104eb423f -[UINavigationController _startDeferredTransitionIfNeeded:] + 712
9 UIKit 0x0000000104eb53af -[UINavigationController __viewWillLayoutSubviews] + 57
10 UIKit 0x000000010505bff7 -[UILayoutContainerView layoutSubviews] + 248
11 UIKit 0x0000000104d8e4a3 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
12 QuartzCore 0x000000010874559a -[CALayer layoutSublayers] + 146
13 QuartzCore 0x0000000108739e70 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
14 QuartzCore 0x0000000108739cee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
15 QuartzCore 0x000000010872e475 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
16 QuartzCore 0x000000010875bc0a _ZN2CA11Transaction6commitEv + 486
17 QuartzCore 0x000000010875c37c _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
18 CoreFoundation 0x0000000104856367 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
19 CoreFoundation 0x00000001048562d7 __CFRunLoopDoObservers + 391
20 CoreFoundation 0x000000010484bf2b __CFRunLoopRun + 1147
21 CoreFoundation 0x000000010484b828 CFRunLoopRunSpecific + 488
22 GraphicsServices 0x0000000107fd2ad2 GSEventRunModal + 161
23 UIKit 0x0000000104cd7610 UIApplicationMain + 171
24 ILFCalc 0x0000000103d898af main + 111
25 libdyld.dylib 0x000000010631a92d start + 1
26 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
This is the error:
* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayI objectAtIndex:]: index 18446744073709551615 beyond bounds [0 .. 1]'
*** First throw call stack:
(
0 CoreFoundation 0x0000000104b09f45 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000104edbdeb objc_exception_throw + 48
2 CoreFoundation 0x00000001049f8b14 -[__NSArrayI objectAtIndex:] + 164
3 MyApp 0x000000010234ae4b -[AppManager homePage] + 203
4 MyApp 0x000000010234a437 -[AppManager init] + 503
5 MyApp 0x000000010234a222 __28+[AppManager sharedInstance]_block_invoke + 50
6 libdispatch.dylib 0x00000001061da49b _dispatch_client_callout + 8
7 libdispatch.dylib 0x00000001061c5e28 dispatch_once_f + 543
8 MyApp 0x000000010234a1cb +[AppManager sharedInstance] + 107
9 MyApp 0x000000010238494b -[SplashViewController viewDidLoad] + 379
10 UIKit 0x0000000103652cc4 -[UIViewController loadViewIfRequired] + 1198
11 UIKit 0x00000001036970ee -[UINavigationController _layoutViewController:] + 54
12 UIKit 0x00000001036979c2 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 462
13 UIKit 0x0000000103697b34 -[UINavigationController _startTransition:fromViewController:toViewController:] + 126
14 UIKit 0x0000000103698d8d -[UINavigationController _startDeferredTransitionIfNeeded:] + 890
15 UIKit 0x0000000103699cea -[UINavigationController __viewWillLayoutSubviews] + 57
16 UIKit 0x000000010383fc85 -[UILayoutContainerView layoutSubviews] + 248
17 UIKit 0x0000000103574e40 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 710
18 QuartzCore 0x000000010324059a -[CALayer layoutSublayers] + 146
19 QuartzCore 0x0000000103234e70 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
20 QuartzCore 0x0000000103234cee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
21 QuartzCore 0x0000000103229475 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
22 QuartzCore 0x0000000103256c0a _ZN2CA11Transaction6commitEv + 486
23 QuartzCore 0x000000010325737c _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
24 CoreFoundation 0x0000000104a35947 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
25 CoreFoundation 0x0000000104a358b7 __CFRunLoopDoObservers + 391
26 CoreFoundation 0x0000000104a2ae2c CFRunLoopRunSpecific + 524
27 UIKit 0x00000001034bb4f5 -[UIApplication _run] + 402
28 UIKit 0x00000001034c030d UIApplicationMain + 171
29 MyApp 0x000000010239b63f main + 111
30 libdyld.dylib 0x000000010620e92d start + 1
31 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I'm not accessing any object inside NSArray which leads to following error, however certainly my app giving me this error.
The error is in your homePage method, which you can see here:
2 CoreFoundation ... -[__NSArrayI objectAtIndex:] + 164
3 MyApp ... -[AppManager homePage] + 203 <----THIS CALLS objectAtIndex: ABOVE
According to the error message, it is trying to access the index 18446744073709551615. This is the value of NSNotFound, which means you are probably handling NSNotFound incorrectly!
Issue with -[AppManager homePage] method kindly check if there is any array accessed there
I really get tired of trying to fix this so I think I need some help. I am filling each Cells of my iOS from an API which I successfully parsed (Can retrieve simple things such as texts, or numbers with no problem)
But when I tried to set the images for the thumbnails I am having some errors.
This is my code:
NSString *imageUrl = [tempDictionary valueForKeyPath:#"files.url_thumb"];
NSURL *url = [NSURL URLWithString:imageUrl];
NSData *imageData = [NSData dataWithContentsOfURL:url];
UIImage *thumbNailImage = [UIImage imageWithData:imageData];
dispatch_async(dispatch_get_main_queue(), ^{
[cell.ThumbImage setImage:thumbNailImage];
});
and this are the nightmares in my console:
2015-04-08 13:14:26.450 WebTableView[4976:173380] -[__NSArrayI length]:
unrecognized selector sent to instance 0x79e18b90
2015-04-08 13:14:26.509 WebTableView[4976:173380] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI length]: unrecognized selector sent to instance 0x79e18b90'
*** First throw call stack:
(
0 CoreFoundation 0x036c9466 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x03352a97 objc_exception_throw + 44
2 CoreFoundation 0x036d12c5 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277
3 CoreFoundation 0x03619bc7 ___forwarding___ + 1047
4 CoreFoundation 0x0361978e _CF_forwarding_prep_0 + 14
5 CoreFoundation 0x035836cf CFStringGetLength + 143
6 CoreFoundation 0x036a9c8d _CFURLCreateWithURLString + 77
7 CoreFoundation 0x035952d3 CFURLCreateWithString + 35
8 Foundation 0x02f17999 -[NSURL(NSURL) initWithString:relativeToURL:] + 371
9 Foundation 0x02f17807 +[NSURL(NSURL) URLWithString:relativeToURL:] + 80
10 Foundation 0x02f177b1 +[NSURL(NSURL) URLWithString:] + 48
11 WebTableView 0x00111a8b -[TableViewController tableView:cellForRowAtIndexPath:] + 571
12 UIKit 0x01c26c9c -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 473
13 UIKit 0x01c26d7e -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 77
14 UIKit 0x01c0054b -[UITableView _updateVisibleCellsNow:isRecursive:] + 3034
15 UIKit 0x01c1aeb1 -[UITableView layoutSubviews] + 222
16 UIKit 0x01b907b1 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 608
17 libobjc.A.dylib 0x03368771 -[NSObject performSelector:withObject:] + 70
18 QuartzCore 0x009421cf -[CALayer layoutSublayers] + 152
19 QuartzCore 0x00936055 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 397
20 QuartzCore 0x00935eb0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
21 QuartzCore 0x008941b6 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 284
22 QuartzCore 0x0089558a _ZN2CA11Transaction6commitEv + 392
23 QuartzCore 0x00895c56 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
24 CoreFoundation 0x035ec18e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
25 CoreFoundation 0x035ec0d0 __CFRunLoopDoObservers + 400
26 CoreFoundation 0x035e1b0a __CFRunLoopRun + 1226
27 CoreFoundation 0x035e137b CFRunLoopRunSpecific + 443
28 CoreFoundation 0x035e11ab CFRunLoopRunInMode + 123
29 GraphicsServices 0x04b3d2c1 GSEventRunModal + 192
30 GraphicsServices 0x04b3d0fe GSEventRun + 104
31 UIKit 0x01b049b6 UIApplicationMain + 1526
32 WebTableView 0x000dd6cd main + 141
33 libdyld.dylib 0x03e94ac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I think valueForKeyPath: returning an array of objects. Try logging imageUrl and check what you are getting.
If you are confident that there would be only one url then you can try this -
NSString *imageUrl = [[tempDictionary valueForKeyPath:#"files.url_thumb"] lastObject];
Else try something like this -
valueForKey:#"files"] valueForKey:#"url_thumb]
I have created an app that is running great on 5.0 and above but when I test on devices lower I have ran into a few issues that I am unsure of how to tackle and correct.
The first big issue is when saving to core data I use a error method that I believe is apples default error method that is created when you make a core data model. The app just crashes when below 5.0 but if I block out the error code everything works fine. Below is the code used to find and error and handle it.
NSError *error;
if (![managedObjectContext save:&error]) { // crash here
// This is a serious error saying the record could not be saved.
// Advise the user to restart the application
}
//crash log below
2012-05-13 10:17:22.062 PreviewMaker[41595:207] -[UIImage encodeWithCoder:]:
unrecognized selector sent to instance 0x5e7ce80
2012-05-13 10:17:22.064 PreviewMaker[41595:207] *** Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason: '-[UIImage encodeWithCoder:]:
unrecognized selector sent to instance 0x5e7ce80'
*** Call stack at first throw:
(
0 CoreFoundation 0x013fc5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0178b313 objc_exception_throw + 44
2 CoreFoundation 0x013fe0bb -[NSObject(NSObject)
doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x0136d966 ___forwarding___ + 966
4 CoreFoundation 0x0136d522 _CF_forwarding_prep_0 + 50
5 Foundation 0x00c45b3e _encodeObject + 1076
6 Foundation 0x00c50f89 +[NSKeyedArchiver
archivedDataWithRootObject:] + 206
7 CoreData 0x01122cb5 -[NSSQLiteConnection execute] +
2677
8 CoreData 0x011771d6 -[NSSQLiteConnection insertRow:]
+ 262
9 CoreData 0x01173e64 -[NSSQLConnection
performAdapterOperations:] + 180
10 CoreData 0x01173b0e -[NSSQLCore
_performChangesWithAdapterOps:] + 494
11 CoreData 0x011725ea -[NSSQLCore performChanges] + 410
12 CoreData 0x0116c038 -[NSSQLCore saveChanges:] + 216
13 CoreData 0x0112a199 -[NSSQLCore
executeRequest:withContext:error:] + 409
14 CoreData 0x011da70b -[NSPersistentStoreCoordinator
executeRequest:withContext:error:] + 3691
15 CoreData 0x01162948 -[NSManagedObjectContext save:] +
712
16 PreviewMaker 0x0000a0c0 -[MainViewController
noUploadJustSaveImage:] + 331
17 PreviewMaker 0x00009d3c -[MainViewController
UserConfirmedToSaveImage] + 756
18 UIKit 0x004774fd -[UIApplication
sendAction:to:from:forEvent:] + 119
19 UIKit 0x00507799 -[UIControl
sendAction:to:forEvent:] + 67
20 UIKit 0x00509c2b -[UIControl(Internal)
_sendActionsForEvents:withEvent:] + 527
21 UIKit 0x005087d8 -[UIControl
touchesEnded:withEvent:] + 458
22 UIKit 0x0049bded -[UIWindow _sendTouchesForEvent:]
+ 567
23 UIKit 0x0047cc37 -[UIApplication sendEvent:] + 447
24 UIKit 0x00481f2e _UIApplicationHandleEvent + 7576
25 GraphicsServices 0x01eb8992 PurpleEventCallback + 1550
26 CoreFoundation 0x013dd944
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
27 CoreFoundation 0x0133dcf7 __CFRunLoopDoSource1 + 215
28 CoreFoundation 0x0133af83 __CFRunLoopRun + 979
29 CoreFoundation 0x0133a840 CFRunLoopRunSpecific + 208
30 CoreFoundation 0x0133a761 CFRunLoopRunInMode + 97
31 GraphicsServices 0x01eb71c4 GSEventRunModal + 217
32 GraphicsServices 0x01eb7289 GSEventRun + 115
33 UIKit 0x00485c93 UIApplicationMain + 1160
34 PreviewMaker 0x00002e07 main + 121
35 PreviewMaker 0x00002d85 start + 53
)
terminate called after throwing an instance of 'NSException'
Another issue I am running into is setting tintColor on UI objects such as the UISwitch. I have a settings controller that has several UISwitches and such which just about all have a tint color set on, but once agin anything below 5.0 crashes. How can I handle the two and not have to re-write the code just to be compatible with devices below 5.0.
shineSwitch = [[[UISwitch alloc] initWithFrame:CGRectZero] autorelease];
[cell.contentView addSubview:shineSwitch];
cell.accessoryView = shineSwitch;
[shineSwitch addTarget:self action:#selector(switchChanged:)
forControlEvents:UIControlEventValueChanged];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
shineSwitch.onTintColor = [UIColor colorWithRed:0.0 green:0.61 blue:0.99 alpha:1.0];
//crash Log below
2012-05-13 10:19:45.033 PreviewMaker[41611:207] -[UISwitch setOnTintColor:]:
unrecognized selector sent to instance 0x5eab860
2012-05-13 10:19:45.034 PreviewMaker[41611:207] *** Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason: '-[UISwitch setOnTintColor:]:
unrecognized selector sent to instance 0x5eab860'
*** Call stack at first throw:
(
0 CoreFoundation 0x013fc5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0178b313 objc_exception_throw + 44
2 CoreFoundation 0x013fe0bb -[NSObject(NSObject)
doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x0136d966 ___forwarding___ + 966
4 CoreFoundation 0x0136d522 _CF_forwarding_prep_0 + 50
5 PreviewMaker 0x0000f6fb -[FlipsideViewController
tableView:cellForRowAtIndexPath:] + 1353
6 UIKit 0x004ecb98 -
[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 634
7 UIKit 0x004e24cc -
[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 75
8 UIKit 0x004f78cc -
[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1561
9 UIKit 0x004ef90c -[UITableView layoutSubviews] +
242
10 QuartzCore 0x001e2a5a -[CALayer layoutSublayers] + 181
11 QuartzCore 0x001e4ddc CALayerLayoutIfNeeded + 220
12 QuartzCore 0x0018a0b4
_ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
13 QuartzCore 0x0018b294 _ZN2CA11Transaction6commitEv +
292
14 QuartzCore 0x0018b46d
_ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
15 CoreFoundation 0x013dd89b
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
16 CoreFoundation 0x013726e7 __CFRunLoopDoObservers + 295
17 CoreFoundation 0x0133b1d7 __CFRunLoopRun + 1575
18 CoreFoundation 0x0133a840 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x0133a761 CFRunLoopRunInMode + 97
20 GraphicsServices 0x01eb71c4 GSEventRunModal + 217
21 GraphicsServices 0x01eb7289 GSEventRun + 115
22 UIKit 0x00485c93 UIApplicationMain + 1160
23 PreviewMaker 0x00002e07 main + 121
24 PreviewMaker 0x00002d85 start + 53
)
terminate called after throwing an instance of 'NSException'
Any help would be greatly appreciated!