transformable

Swift And CoreData With Custom Class As Transformable Object

≡放荡痞女 提交于 2021-01-27 14:37:15
问题 I am trying to use a custom class with swift and CoreData as a transformable object. I have been wasting hours trying to figure it out but cannot. I keep getting two errors: Property cannot be marked @NSManaged because its type cannot be represented in Objective-C and Property cannot be declared public because its type uses an internal type. Help is greatly appreciated. Thanks. I have a CoreData object named User. I also have an object named Site. I don't want the Site object to be a CoreData

Core Data Transformable attributes NOT working with NSPredicate

☆樱花仙子☆ 提交于 2019-12-12 07:57:02
问题 I often use Transformable for Core Data attributes , so I can change them later. However, it seems like, if I want to use NSPredicate to find a NSManagedObject , using "uniqueKey == %@" , or "uniqueKey MATCHES[cd] %@" , it's not working as it should. It always misses matching objects, until I change the attributes of the uniqueKey of the matching object to have specific class like NSString , or NSNumber . Can someone explain the limitation of using NSPredicate with Transformable attributes?

Using NSPredicate with transformable attribute in Core Data

你离开我真会死。 提交于 2019-12-11 14:45:43
问题 I have A class ( TestClass ) and it has two Properties ID : String and Code : Int . class TestClass : NSObject , NSCoding { @objc let ID : Int32 @objc let Code : String init(id : Int32, code : String) { self.ID = id self.Code = code } public func encode(with aCoder: NSCoder) { aCoder.encode(ID, forKey: "ID") aCoder.encode(Code, forKey: "Code") } required public convenience init?(coder aDecoder: NSCoder) { guard let id = aDecoder.decodeObject(forKey: "ID") as? Int32, let code = aDecoder

Error: -[UIImage _deleteExternalReferenceFromPermanentLocation] unrecognized selector sent to instance

风格不统一 提交于 2019-12-09 10:49:42
问题 When I delete a managed object that contains image, stored as transformable value in external record, then I got crash and this error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage _deleteExternalReferenceFromPermanentLocation]: unrecognized selector sent to instance 0xde49360' 回答1: I answered to something similar in the Apple Developer forums. I am guessing you have the external storage checkbox selected on that field in the data modeller. There

Core Data Transformable attributes NOT working with NSPredicate

删除回忆录丶 提交于 2019-12-03 13:06:20
I often use Transformable for Core Data attributes , so I can change them later. However, it seems like, if I want to use NSPredicate to find a NSManagedObject , using "uniqueKey == %@" , or "uniqueKey MATCHES[cd] %@" , it's not working as it should. It always misses matching objects, until I change the attributes of the uniqueKey of the matching object to have specific class like NSString , or NSNumber . Can someone explain the limitation of using NSPredicate with Transformable attributes? Note : I'm not sure when/if this has changed since 5/2011 (from Scott Ahten's accepted answer), but you

How do I get mogenerator to recognize the proper type for Transformable attributes?

主宰稳场 提交于 2019-12-03 01:15:42
问题 I have a Core Data model with a single transformable attribute. I also have this attribute use a custom NSValueTransformer, setup in the model properly. When I use mogenerator to generate/update my machine and human files, the machine files for the entity containing this attribute always type the attribute to NSObject. In order for Core Data to use my custom value transformer, this type needs to be the type the transformer understands. Right now, I manually do this in the human file by

How do I get mogenerator to recognize the proper type for Transformable attributes?

白昼怎懂夜的黑 提交于 2019-12-02 14:30:15
I have a Core Data model with a single transformable attribute. I also have this attribute use a custom NSValueTransformer, setup in the model properly. When I use mogenerator to generate/update my machine and human files, the machine files for the entity containing this attribute always type the attribute to NSObject. In order for Core Data to use my custom value transformer, this type needs to be the type the transformer understands. Right now, I manually do this in the human file by redefining the property with the proper type. This does the job and gets the transformer working. However, I