nsmanagedobject

Swift: @objc(…) Attribute

荒凉一梦 提交于 2021-02-11 17:10:45
问题 In Apple-generated code (Core Data NSManagedObject subclasses, for example) I see this: @objc(LPFile) public class LPFile: NSManagedObject { ... } My question is: why is the @objc declaration done as above, instead of: @objc public class LPFile: NSManagedObject { ... } or @objcMembers public class LPFile: NSManagedObject { ... } What is special about the separate @objc(identifier) declaration? I can't seem to find documentation about it and googling just turns up the other two approaches.

Swift: @objc(…) Attribute

半世苍凉 提交于 2021-02-11 17:10:12
问题 In Apple-generated code (Core Data NSManagedObject subclasses, for example) I see this: @objc(LPFile) public class LPFile: NSManagedObject { ... } My question is: why is the @objc declaration done as above, instead of: @objc public class LPFile: NSManagedObject { ... } or @objcMembers public class LPFile: NSManagedObject { ... } What is special about the separate @objc(identifier) declaration? I can't seem to find documentation about it and googling just turns up the other two approaches.

Swift: @objc(…) Attribute

ⅰ亾dé卋堺 提交于 2021-02-11 17:08:44
问题 In Apple-generated code (Core Data NSManagedObject subclasses, for example) I see this: @objc(LPFile) public class LPFile: NSManagedObject { ... } My question is: why is the @objc declaration done as above, instead of: @objc public class LPFile: NSManagedObject { ... } or @objcMembers public class LPFile: NSManagedObject { ... } What is special about the separate @objc(identifier) declaration? I can't seem to find documentation about it and googling just turns up the other two approaches.

The given data did not contain a top-level value error when attempting to decode json into NSManagedObject

牧云@^-^@ 提交于 2021-02-07 10:53:49
问题 While migrating an app from Realm to CoreData, I'm attempting to parse the following JSON structure: { "username": "972542052677", "displayName": "Arik", "countryCode": "972", "status": "Busy", "walletPublicKey": "XgWDiGMFRPDRVnRq8nxu7NyMLuT4Uez7mJ", "lastSeen": "2020-08-05T08:12:57.5267881", "isOnline": false } I need to create an NSManagedObject from this data so I'm following this tutorial: https://medium.com/@andrea.prearo/working-with-codable-and-core-data-83983e77198e This is the model.

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

CoreData merge conflict shows managed object version change not data

时光怂恿深爱的人放手 提交于 2020-12-26 07:19:17
问题 I am have an entity in core data and I try to update it from two different context. I am storing managedObjectID of my managed object which I need to update as it is thread safe. Before updating my object I refresh the object to avoid merge conflict. Here is my code: context1.performBlock { let myObject = context1.objectWithID(managedObjectId) context1.refreshObject(myObject, mergeChanges: true) myObject.property1 = newValue } Notice that I haven't saved the context here, as I want to commit

Why might releasing a managed object crash in -[_PFManagedObjectReferenceQueue _queueForDealloc:]?

南楼画角 提交于 2020-02-13 02:11:11
问题 I am occasionally seeing crashes with a stack trace like this: 0 libobjc.A.dylib 0x97dc0edb objc_msgSend + 27 1 com.apple.CoreData 0x97edcdc2 -[_PFManagedObjectReferenceQueue _queueForDealloc:] + 162 2 com.apple.CoreData 0x97edccbe -[NSManagedObject release] + 94 3 com.apple.CoreFoundation 0x9318ef38 CFRelease + 152 4 com.apple.CoreFoundation 0x931a7460 __CFBasicHashStandardCallback + 384 5 com.apple.CoreFoundation 0x931a706e __CFBasicHashDrain + 478 6 com.apple.CoreFoundation 0x9318f101

use uitextfield delegetate to fetch coredata binary data by its count number

一曲冷凌霜 提交于 2020-02-06 07:41:25
问题 My swift code saves 3 names to core data entity "username". I want to use uitextfield delegate to pull a specific string. So when the user enters 2 in the textfield. On the label labelName the name jessica Biel should appear. So the user enters a number into a textfield a string appears on the label. If number 1 is enter the 1st NSManagedObject into the core data entity userName. Link to project https://github.com/redrock34/jessicaBiel import UIKit import CoreData class ViewController:

Saving NSManagedObject in NSUserDefaults

你说的曾经没有我的故事 提交于 2020-01-25 06:57:05
问题 Hello everyone (sorry for my bad english, I'm French), I'm trying to put my NSManagedObject into NSUserDefaults to retrieve it with its relationships. Basically I used NSCoding and I had implemented the required method, but because it's NSManaged objects, the signature of the init method it's : init(entity: NSEntityDescription, insertIntoManagedObjectContext context: NSManagedObjectContext?). The message is "'NSInvalidArgumentException', reason: 'Illegal attempt to establish a relationship

'filenames are used to distinguish private declarations of the same name' error

为君一笑 提交于 2020-01-19 06:53:31
问题 I am getting this error on generating an NSManagedObject in Xcode 8.1 in Swift. :0: error: filename "DemoOne+CoreDataClass.swift" used twice: '/Users/Swasidhant/Desktop/demo again/DemoOne+CoreDataClass.swift' and '/Users/Swasidhant/Library/Developer/Xcode/DerivedData/demo_again-hiinrbwwbmyfbrbctsfdzvudkkuy/Build/Intermediates/demo again.build/Debug-iphonesimulator/demo again.build/DerivedSources/CoreDataGenerated/Model/DemoOne+CoreDataClass.swift' :0: note: filenames are used to distinguish