Hi Everyone,
I am having a bit of an issue with saving an UIImage to my CoreData model. I am following the Recipes example for CoreData and I can't find where I went wrong. Once I select a photo (while view is editing) the image goes to the view ImageView, but then once I press the Done button my app crashes with the error:
Quote:
[UIImage encodeWithCoder:]: unrecognized selector sent to instance 0x6083080
2011-07-03 19:40:28.988 BandManager[25028:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage encodeWithCoder:]: unrecognized selector sent to instance 0x6083080'
*** Call stack at first throw:
(
0 CoreFoundation 0x0171a5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0186e313 objc_exception_throw + 44
2 CoreFoundation 0x0171c0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x0168b966 ___forwarding___ + 966
4 CoreFoundation 0x0168b522 _CF_forwarding_prep_0 + 50
5 Foundation 0x0113ab3e _encodeObject + 1076
6 Foundation 0x01145f89 +[NSKeyedArchiver archivedDataWithRootObject:] + 206
7 CoreData 0x0079ecb5 -[NSSQLiteConnection execute] + 2677
8 CoreData 0x007f0ebd -[NSSQLiteConnection updateRow:] + 365
9 CoreData 0x007efe64 -[NSSQLConnection performAdapterOperations:] + 180
10 CoreData 0x007efb0e -[NSSQLCore _performChangesWithAdapterOps:] + 494
11 CoreData 0x007ee5ea -[NSSQLCore performChanges] + 410
12 CoreData 0x007e8038 -[NSSQLCore saveChanges:] + 216
13 CoreData 0x007a6199 -[NSSQLCore executeRequest:withContext:error:] + 409
14 CoreData 0x0085670b -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 3691
15 CoreData 0x007de948 -[NSManagedObjectContext save:] + 712
16 BandManager 0x000320db -[GigDetailViewController setEditing:animated:] + 1259
17 UIKit 0x00a17d1e -[UIViewController(UINavigationControllerItem) _toggleEditing:] + 77
|
I have the ImageToDataTransformer interface defined in my ManagedObject, and I have the Image set to Transformable in the data model. Just when
Code:
[ManagedObjectContext save:&error]
in
Code:
- (void)setEditing:(BOOL)editing animated:(BOOL)animated
is called it crashes. If anyone could help me out I would really appreciate it!