JSON Thumbnail image in Custom Table View Cell - ios

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]

Related

CIGaussianBlur exception [UIImage _internalRepresentation]

I am trying to statically blur an UIImage using the method below:
func blurImage(image: UIImage!, blurLevel: CGFloat!) -> UIImage! {
if self.context == nil {
self.context = CIContext();
}
let inputImage = CIImage(image: image);
let filter = CIFilter(name: "CIGaussianBlur");
filter.setValue(image, forKey: kCIInputImageKey);
filter.setValue(blurLevel, forKey: kCIInputRadiusKey);
let outputImage = filter.valueForKey(kCIOutputImageKey) as CIImage;
let outImage = self.context?.createCGImage(outputImage, fromRect: outputImage.extent());
return UIImage(CGImage: outImage)!;
}
But the debugger immediately raises an exception on filter.valueForKey(kCIOutputImageKey), confirmed by trying to print the object in the LLDB debugger:
-[UIImage _internalRepresentation]: unrecognized selector sent to instance 0x7fef33e89b00
Does anyone know why this exception is surfacing? I've tried different variations of the method to no avail as per various stack overflow questions, but I can't seem to figure this out...
I suspect it may just be a just a bug on Apple's part after more investigation, but if anyone has encountered this before help is appreciated
Stacktrace
2015-03-09 19:34:14.502 Rocks[3346:511164] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage _internalRepresentation]: unrecognized selector sent to instance 0x7fef33e89b00'
*** First throw call stack:
(
0 CoreFoundation 0x0000000112106f35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000111d9fbb7 objc_exception_throw + 45
2 CoreFoundation 0x000000011210e04d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000011206627c ___forwarding___ + 988
4 CoreFoundation 0x0000000112065e18 _CF_forwarding_prep_0 + 120
5 CoreImage 0x000000011192cef7 -[CIGaussianBlur outputImage] + 108
6 Foundation 0x000000010f939823 -[NSObject(NSKeyValueCoding) valueForKey:] + 251
7 Rocks 0x000000010f588024 _TFC4Rocks23LocalCollectionViewCell9blurImagefS0_FTGSQCSo7UIImage_9blurLevelGSQV12CoreGraphics7CGFloat__GSQS1__ + 3284
8 Rocks 0x000000010f589538 _TFC4Rocks23LocalCollectionViewCell31requestCellProfilePictureChangefS0_FGSQPSs9AnyObject__T_ + 3544
9 Rocks 0x000000010f58450c _TFC4Rocks29LocalCollectionViewController14collectionViewfS0_FTCSo16UICollectionView22cellForItemAtIndexPathCSo11NSIndexPath_CSo20UICollectionViewCell + 860
10 Rocks 0x000000010f584b6f _TToFC4Rocks29LocalCollectionViewController14collectionViewfS0_FTCSo16UICollectionView22cellForItemAtIndexPathCSo11NSIndexPath_CSo20UICollectionViewCell + 79
11 UIKit 0x0000000110bea41b -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 244
12 UIKit 0x0000000110bebb54 -[UICollectionView _updateVisibleCellsNow:] + 3445
13 UIKit 0x0000000110bef801 -[UICollectionView layoutSubviews] + 243
14 UIKit 0x0000000110635973 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521
15 QuartzCore 0x00000001103a0de8 -[CALayer layoutSublayers] + 150
16 QuartzCore 0x0000000110395a0e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
17 QuartzCore 0x000000011039587e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
18 QuartzCore 0x000000011030363e _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
19 QuartzCore 0x000000011030474a _ZN2CA11Transaction6commitEv + 390
20 UIKit 0x00000001105ba54d -[UIApplication _reportMainSceneUpdateFinished:] + 44
21 UIKit 0x00000001105bb238 -[UIApplication _runWithMainScene:transitionContext:completion:] + 2642
22 UIKit 0x00000001105b9bf2 -[UIApplication workspaceDidEndTransaction:] + 179
23 FrontBoardServices 0x0000000115f0b2a3 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
24 CoreFoundation 0x000000011203c53c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
25 CoreFoundation 0x0000000112032285 __CFRunLoopDoBlocks + 341
26 CoreFoundation 0x0000000112032045 __CFRunLoopRun + 2389
27 CoreFoundation 0x0000000112031486 CFRunLoopRunSpecific + 470
28 UIKit 0x00000001105b9669 -[UIApplication _run] + 413
29 UIKit 0x00000001105bc420 UIApplicationMain + 1282
30 Rocks 0x000000010f59262e top_level_code + 78
31 Rocks 0x000000010f59266a main + 42
32 libdyld.dylib 0x0000000112bb8145 start + 1
33 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

App crashes while loading image via URL iOS

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.

terminating uncaught exception of type NSException

My game is constantly crashing after pressing a certain button after restarting the game.
An animation is always running during the game in the ViewController I'm running the game on.
Here is the crash log. Is there any way to detect how is this crash related to my animation?
2014-08-05 00:21:30.044 windmill[702:90b] -[CALayer doubleValue]: unrecognized selector sent to instance 0xec32a10
2014-08-05 00:21:30.053 windmill[702:90b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CALayer doubleValue]: unrecognized selector sent to instance 0xec32a10'
*** First throw call stack:
(
0 CoreFoundation 0x01c501e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x019cf8e5 objc_exception_throw + 44
2 CoreFoundation 0x01ced243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x01c4050b ___forwarding___ + 1019
4 CoreFoundation 0x01c400ee _CF_forwarding_prep_0 + 14
5 QuartzCore 0x0013b9b8 CAObject_setValueForKeyPath_ + 2435
6 QuartzCore 0x0012129b -[CALayer setValue:forKeyPath:] + 471
7 QuartzCore 0x00105d51 -[CABasicAnimation applyForTime:presentationObject:modelObject:] + 1178
8 QuartzCore 0x0012415c _ZN2CA5Layer18presentation_layerEPNS_11TransactionE + 494
9 QuartzCore 0x00127cbe -[CALayer presentationLayer] + 43
10 UIKit 0x006eb0f1 _UIViewEatsTouches + 142
11 UIKit 0x006eb250 -[UIView(Geometry) hitTest:withEvent:] + 114
12 UIKit 0x006eb4f4 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke + 132
13 CoreFoundation 0x01cccd86 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 102
14 CoreFoundation 0x01cccc5f -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 239
15 UIKit 0x006eb35c -[UIView(Geometry) hitTest:withEvent:] + 382
16 UIKit 0x006eb4f4 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke + 132
17 CoreFoundation 0x01cccd86 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 102
18 CoreFoundation 0x01cccc5f -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 239
19 UIKit 0x006eb35c -[UIView(Geometry) hitTest:withEvent:] + 382
20 UIKit 0x006daeb1 __54+[UIWindow _hitTestToPoint:pathIndex:forEvent:screen:]_block_invoke + 175
21 UIKit 0x006dad1e +[UIWindow _topVisibleWindowPassingTest:] + 198
22 UIKit 0x006dadfa +[UIWindow _hitTestToPoint:pathIndex:forEvent:screen:] + 176
23 UIKit 0x0068c5bb _UIApplicationHandleEventQueue + 7975
24 CoreFoundation 0x01bd977f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
25 CoreFoundation 0x01bd910b __CFRunLoopDoSources0 + 235
26 CoreFoundation 0x01bf61ae __CFRunLoopRun + 910
27 CoreFoundation 0x01bf59d3 CFRunLoopRunSpecific + 467
28 CoreFoundation 0x01bf57eb CFRunLoopRunInMode + 123
29 GraphicsServices 0x0341c5ee GSEventRunModal + 192
30 GraphicsServices 0x0341c42b GSEventRun + 104
31 UIKit 0x0068ff9b UIApplicationMain + 1225
32 windmill 0x00004afd main + 141
33 libdyld.dylib 0x03103725 start + 0
34 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
When I press buttons in the view , the app crashes. Here is the animation code:
CABasicAnimation *fullRotation = [CABasicAnimation animationWithKeyPath:#"transform.rotation"];
fullRotation.fromValue = [NSNumber numberWithFloat:0];
fullRotation.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
fullRotation.duration = 4;
fullRotation.repeatCount= 1000;
[[stick layer] addAnimation:fullRotation forKey:#"60"];}
I'm sorry if the code is messed up , I'm still learning and building small apps and games to get a better practice. Thanks.
You should remove the lines with fullRotation.fromValue, since it ought not to have a CALayer assigned to itself.
fullRotation.fromValue = self.view.layer.presentationLayer;

Why unknown selector when calling JSONRPC on XBMC?

can someone give me a hint why i always geht an
"DSJSONRPC doesNotRecognizeSelector" when calling jsonrpc interface from XBMC?
Result in console:
*** JSON-RPC REQUEST:
{
id = 654509193;
jsonrpc = "2.0";
method = "Player.GetActivePlayers";
params = {
};
}
Code:
DSJSONRPC *jsonRPC = [[DSJSONRPC alloc] initWithServiceEndpoint:[NSURL URLWithString:#"http://192.168.1.101:8080/jsonrpc"]];
[jsonRPC callMethod:#"Player.GetActivePlayers" withParameters:#{ }
onCompletion:^(NSString *methodName, NSInteger callId, id methodResult, DSJSONRPCError *methodError, NSError* internalError)
Using DSJSONRPC from Demiurgic JSON RPC
Can't find the error - on XBMC a movie is playing at this time...
Thanks in advance,
cheese
here the error stack:
2013-12-22 22:02:52.846 XBMCapp[3529:70b] *** JSON-RPC REQUEST:
{
id = "-1698136466";
jsonrpc = "2.0";
method = "Player.GetActivePlayers";
params = {
};
}
2013-12-22 22:02:52.847 XBMCapp[3529:70b] Error:<DSJSONRPC: 0x95c11b0>
2013-12-22 22:02:52.847 XBMCapp[3529:70b] -[DSJSONRPC localizedDescription]: unrecognized selector sent to instance 0x95c11b0
2013-12-22 22:02:52.873 XBMCapp[3529:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DSJSONRPC localizedDescription]: unrecognized selector sent to instance 0x95c11b0'
*** First throw call stack:
(
0 CoreFoundation 0x01ef25e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x018058b6 objc_exception_throw + 44
2 CoreFoundation 0x01f8f903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x01ee290b ___forwarding___ + 1019
4 CoreFoundation 0x01ee24ee _CF_forwarding_prep_0 + 14
5 XBMCapp 0x000109ab -[DSJSONRPC callMethod:withParameters:onCompletion:] + 477
6 XBMCapp 0x000054df -[RootViewController nowplayingAction:] + 298
7 libobjc.A.dylib 0x01817874 -[NSObject performSelector:withObject:withObject:] + 77
8 UIKit 0x004780c2 -[UIApplication sendAction:to:from:forEvent:] + 108
9 UIKit 0x0074cc9b -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 139
10 libobjc.A.dylib 0x01817874 -[NSObject performSelector:withObject:withObject:] + 77
11 UIKit 0x004780c2 -[UIApplication sendAction:to:from:forEvent:] + 108
12 UIKit 0x0047804e -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
13 UIKit 0x005700c1 -[UIControl sendAction:to:forEvent:] + 66
14 UIKit 0x00570484 -[UIControl _sendActionsForEvents:withEvent:] + 577
15 UIKit 0x0056f733 -[UIControl touchesEnded:withEvent:] + 641
16 UIKit 0x004b551d -[UIWindow _sendTouchesForEvent:] + 852
17 UIKit 0x004b6184 -[UIWindow sendEvent:] + 1232
18 UIKit 0x00489e86 -[UIApplication sendEvent:] + 242
19 UIKit 0x0047418f _UIApplicationHandleEventQueue + 11421
20 CoreFoundation 0x01e7b83f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
21 CoreFoundation 0x01e7b1cb __CFRunLoopDoSources0 + 235
22 CoreFoundation 0x01e9829e __CFRunLoopRun + 910
23 CoreFoundation 0x01e97ac3 CFRunLoopRunSpecific + 467
24 CoreFoundation 0x01e978db CFRunLoopRunInMode + 123
25 GraphicsServices 0x02d889e2 GSEventRunModal + 192
26 GraphicsServices 0x02d88809 GSEventRun + 104
27 UIKit 0x00476d3b UIApplicationMain + 1225
28 XBMCapp 0x0000234b main + 93
29 libdyld.dylib 0x02a2a70d start + 1
30 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
ok, found the problem - perhaps I have an old version of the JSON class...
There was an uninitialised error variable...
changing it to nil then everything works like a charm.
thanks anyway :)

Handling Compatibility issues IOS 4.0- 5.1

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!

Resources