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
Related
In Cocoa Touch Framework Target. I add following methods to UIScrollView.
public extension UIScrollView {
public func beginRefresh() {
print("beginRefresh")
}
public func endRefresh() {
print("endRefresh")
}
}
In iOS App Target as Demo App. I invoke those methods on UITableView instance. It crash.
override func viewDidLoad() {
super.viewDidLoad()
tableView.beginRefresh()
}
Crash Log:
2016-08-10 16:22:29.736 DTRefresh iOS Example[7373:210619]
-[UITableView beginRefresh]: unrecognized selector sent to instance 0x7fc91b019e00 2016-08-10 16:22:29.751 DTRefresh iOS
Example[7373:210619] * Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[UITableView beginRefresh]:
unrecognized selector sent to instance 0x7fc91b019e00'
* First throw call stack: ( 0 CoreFoundation 0x0000000109c39d85 exceptionPreprocess + 165 1 libobjc.A.dylib
0x000000010b9dddeb objc_exception_throw + 48 2 CoreFoundation
0x0000000109c42d3d -[NSObject(NSObject) doesNotRecognizeSelector:] +
205 3 CoreFoundation 0x0000000109b88cfa
___forwarding_ + 970 4 CoreFoundation 0x0000000109b888a8 _CF_forwarding_prep_0 + 120 5 DTRefresh iOS
Example 0x0000000109a54a81
_TFC21DTRefresh_iOS_Example18ListViewController11viewDidLoadfT_T_ + 561 6 DTRefresh iOS Example 0x0000000109a54b22
_TToFC21DTRefresh_iOS_Example18ListViewController11viewDidLoadfT_T_ + 34 7 UIKit 0x000000010a5fc984
-[UIViewController loadViewIfRequired] + 1198 8 UIKit 0x000000010a5fccd3 -[UIViewController view] + 27 9 UIKit
0x000000010a4d2fb4 -[UIWindow addRootViewControllerViewIfPossible] +
61 10 UIKit 0x000000010a4d369d
-[UIWindow _setHidden:forced:] + 282 11 UIKit 0x00000001193a5d16 -[UIWindowAccessibility
_orderFrontWithoutMakingKey] + 68 12 UIKit 0x000000010a4e5180 -[UIWindow makeKeyAndVisible] + 42 13 UIKit
0x000000010a459ed9 -[UIApplication
_callInitializationDelegatesForMainScene:transitionContext:] + 4131 14 UIKit 0x000000010a460568
-[UIApplication _runWithMainScene:transitionContext:completion:] + 1769 15 UIKit 0x000000010a45d714
-[UIApplication workspaceDidEndTransaction:] + 188 16 FrontBoardServices 0x000000010d86e8c8
FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 24 17 FrontBoardServices 0x000000010d86e741
-[FBSSerialQueue _performNext] + 178 18 FrontBoardServices 0x000000010d86eaca -[FBSSerialQueue _performNextFromRunLoopSource] +
45 19 CoreFoundation 0x0000000109b5f301
CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 20 CoreFoundation 0x0000000109b5522c
__CFRunLoopDoSources0 + 556 21 CoreFoundation 0x0000000109b546e3 __CFRunLoopRun + 867 22 CoreFoundation
0x0000000109b540f8 CFRunLoopRunSpecific + 488 23 UIKit
0x000000010a45cf21 -[UIApplication _run] + 402 24 UIKit
0x000000010a461f09 UIApplicationMain + 171 25 DTRefresh iOS Example
0x0000000109a54662 main + 114 26 libdyld.dylib
0x000000010c4a192d start + 1 27 ???
0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with
uncaught exception of type NSException
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 am getting the error [__NSCFArray objectForKey:]: unrecognized selector sent to instance when trying to fetch some data from my Core Data.
I am relatively new to iOS programming and don't quite understand what this error is trying to tell me. I set an exception breakpoint to figure out which line is giving me the problem and it is this line of code:
if let fetchResults = managedObjectContext!.executeFetchRequest(fetchRequest, error: nil) as? [User] {
Why am I getting this error and how do I resolve it? Is this related to the way I save my Core Data? I just recently did a change where I receive a JSON from the server, then process in the background and then finally save changes to my ManagedObjectContext in the main thread.
func getUser(userId: String) -> User? {
let fetchRequest = NSFetchRequest(entityName: "User")
fetchRequest.predicate = NSPredicate(format: "userId == %#", userId)
fetchRequest.fetchLimit = 1
if let fetchResults = managedObjectContext!.executeFetchRequest(fetchRequest, error: nil) as? [User] {
if !fetchResults.isEmpty {
return fetchResults[0]
}
else {
println("UserId \(userId) not in database")
}
}
return nil
}
Error
2014-12-06 13:09:36.087 LFDate[3162:51570] -[__NSCFArray objectForKey:]: unrecognized selector sent to instance 0x7fb9e95c4310
2014-12-06 13:09:36.090 LFDate[3162:51570] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFArray objectForKey:]: unrecognized selector sent to instance 0x7fb9e95c4310'
*** First throw call stack:
(
0 CoreFoundation 0x00000001025c2f35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010465ebb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001025ca04d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010252227c ___forwarding___ + 988
4 CoreFoundation 0x0000000102521e18 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x000000010248beaf CFDictionaryGetValue + 159
6 Foundation 0x0000000102befd78 -[NSKeyedUnarchiver initForReadingWithData:] + 1698
7 Foundation 0x0000000102c135ea +[NSKeyedUnarchiver unarchiveObjectWithData:] + 66
8 CoreData 0x000000010210b4e0 _prepareResultsFromResultSet + 3552
9 CoreData 0x0000000102108930 newFetchedRowsForFetchPlan_MT + 3296
10 CoreData 0x00000001020f53ac -[NSSQLCore objectsForFetchRequest:inContext:] + 524
11 CoreData 0x00000001020f4e2b -[NSSQLCore executeRequest:withContext:error:] + 299
12 CoreData 0x00000001021ca4f3 __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke + 3331
13 CoreData 0x00000001021d27ee gutsOfBlockToNSPersistentStoreCoordinatorPerform + 190
14 libdispatch.dylib 0x00000001052117f4 _dispatch_client_callout + 8
15 libdispatch.dylib 0x00000001051f8774 _dispatch_barrier_sync_f_invoke + 365
16 CoreData 0x00000001021c53d5 _perform + 197
17 CoreData 0x00000001020f4ac8 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 504
18 CoreData 0x00000001020f33e0 -[NSManagedObjectContext executeFetchRequest:error:] + 544
19 LFDate 0x0000000101b9c3b3 _TFC6LFDate14DatabaseHelper7getUserfS0_FSSGSqCS_4User_ + 1075
20 LFDate 0x0000000101c4ce01 _TFC6LFDate23MenuTableViewController9tableViewfS0_FTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 4689
21 LFDate 0x0000000101c4e4ff _TToFC6LFDate23MenuTableViewController9tableViewfS0_FTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 79
22 UIKit 0x000000010349d4b3 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 508
23 UIKit 0x000000010347cfb1 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2846
24 UIKit 0x0000000103492e3c -[UITableView layoutSubviews] + 213
25 UIKit 0x000000010341f973 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521
26 QuartzCore 0x000000010318ade8 -[CALayer layoutSublayers] + 150
27 QuartzCore 0x000000010317fa0e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
28 QuartzCore 0x000000010317f87e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
29 QuartzCore 0x00000001030ed63e _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
30 QuartzCore 0x00000001030ee74a _ZN2CA11Transaction6commitEv + 390
31 QuartzCore 0x00000001030eedb5 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
32 CoreFoundation 0x00000001024f7dc7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
33 CoreFoundation 0x00000001024f7d20 __CFRunLoopDoObservers + 368
34 CoreFoundation 0x00000001024edb53 __CFRunLoopRun + 1123
35 CoreFoundation 0x00000001024ed486 CFRunLoopRunSpecific + 470
36 GraphicsServices 0x00000001072f09f0 GSEventRunModal + 161
37 UIKit 0x00000001033a6420 UIApplicationMain + 1282
38 LFDate 0x0000000101be33ae top_level_code + 78
39 LFDate 0x0000000101be33ea main + 42
40 libdyld.dylib 0x0000000105246145 start + 1
41 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I have an app which has 5 UIViewControllers and the rootViewController is attached to a UINavigationController and the others are connected by segues. Now, I want to add a title to the UINavigationController. I have tried different things in viewDidLoad and viewDidAppear:
self.text = "Hello" // Runtime Error
self.navigationController?.navigationBar.topItem?.title = "Hello" // Runtime Error
self.navigationController?.visibleViewController.title = "Hello" // Runtime Error
The UIViewController that I am calling this is like this:
class LoginTypeActivityViewController: PPViewController{
}
Where, PPViewController is declared like this:
class PPViewController: UIViewController{
}
The runtime error is:
2014-10-13 17:21:27.878 mobilepay[29387:1382271] -[Swift._NSContiguousString set]: unrecognized selector sent to instance 0x7b6b33d0
2014-10-13 17:21:27.881 mobilepay[29387:1382271] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Swift._NSContiguousString set]: unrecognized selector sent to instance 0x7b6b33d0'
*** First throw call stack:
(
0 CoreFoundation 0x00bb5df6 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x0083fa97 objc_exception_throw + 44
2 CoreFoundation 0x00bbda75 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277
3 CoreFoundation 0x00b069c7 ___forwarding___ + 1047
4 CoreFoundation 0x00b0658e _CF_forwarding_prep_0 + 14
5 UIFoundation 0x067eeb91 __NSStringDrawingEngine + 29221
6 UIFoundation 0x067e784d -[NSString(NSExtendedStringDrawing) drawWithRect:options:attributes:context:] + 171
7 UIKit 0x013be151 -[UILabel _drawTextInRect:baselineCalculationOnly:] + 6626
8 UIKit 0x013bbe30 -[UILabel drawTextInRect:] + 581
9 UIKit 0x013be256 -[UILabel drawRect:] + 98
10 UIKit 0x0123354b -[UIView(CALayerDelegate) drawLayer:inContext:] + 519
11 QuartzCore 0x01077d51 -[CALayer drawInContext:] + 118
12 QuartzCore 0x01077c87 _ZL16backing_callbackP9CGContextPv + 96
13 QuartzCore 0x00f5c7ae CABackingStoreUpdate_ + 2788
14 QuartzCore 0x01077c1f ___ZN2CA5Layer8display_Ev_block_invoke + 93
15 QuartzCore 0x010ad406 x_blame_allocations + 15
16 QuartzCore 0x01077a85 _ZN2CA5Layer8display_Ev + 1591
17 QuartzCore 0x01077cd6 -[CALayer _display] + 33
18 QuartzCore 0x01077446 _ZN2CA5Layer7displayEv + 142
19 QuartzCore 0x01077cb0 -[CALayer display] + 33
20 QuartzCore 0x0106bee6 _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 322
21 QuartzCore 0x0106bf6c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 38
22 QuartzCore 0x00fca676 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 284
23 QuartzCore 0x00fcba3c _ZN2CA11Transaction6commitEv + 392
24 QuartzCore 0x00fcc108 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
25 CoreFoundation 0x00ad8fbe __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
26 CoreFoundation 0x00ad8f00 __CFRunLoopDoObservers + 400
27 CoreFoundation 0x00ace93a __CFRunLoopRun + 1226
28 CoreFoundation 0x00ace1ab CFRunLoopRunSpecific + 443
29 CoreFoundation 0x00acdfdb CFRunLoopRunInMode + 123
30 GraphicsServices 0x0317124f GSEventRunModal + 192
31 GraphicsServices 0x0317108c GSEventRun + 104
32 UIKit 0x011a8e16 UIApplicationMain + 1526
33 mobilepay 0x001410de top_level_code + 78
34 mobilepay 0x0014111b main + 43
35 libdyld.dylib 0x03ad7ac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
What can be the error? I am stuck since the last 5 hours here.
I am trying to set the title different in different UIViewControllers.
In your viewDidLoad(), type:
title = "Hello World"
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!