NSInvocation error in class which doesn't exist anymore - iphone

I had a class named "Object", changed the name to TheObject (everywhere in my project) cause I thought it would cause problems. (TheObject is a CoreData generated class)
Now i get this error:
2012-09-21 14:19:45.794 Choose3[1348:fb03] *** NSInvocation: warning: object 0x191f500 of class 'Object' does not implement methodSignatureForSelector: -- trouble ahead
2012-09-21 14:19:45.794 Choose3[1348:fb03] *** NSInvocation: warning: object 0x191f500 of class 'Object' does not implement doesNotRecognizeSelector: -- abort
Why does Xcode still think I have a class named Object while I haven't ?

The name of the entity in the model was changed but the class of the entity was still Object, and not TheObject.

Related

Instantiating Realm model class crashes with missing key error

When trying to instantiate my RealmDouble model I get the following error:
*** Terminating app due to uncaught exception 'RLMException', reason: 'Invalid value '0' to initialize object of type 'RealmDouble': missing
key 'double_value'
class RealmDouble: Object {
dynamic var double_value: Double = 0.00
}
RealmDouble(value: 0.0)
I have tried deleting the app from the simulator, as well as deleting the Realm file. Does anyone know how to fix this?
You'd see this exception if you're passing a Double in a place where Realm expects to see either a dictionary from property names to values or an array of values, such as Realm.create(_:value:update). For instance, you'll see an error like this from the following code:
realm.create(RealmDouble.self, value: 0.0)
You should instead do:
realm.create(RealmDouble.self, value: [0.0])
From the future if it helps anyone:
Same error was thrown when I accidentally passed the wrong Type on the first parameter of the method realm.create(type: T.Type, value:_, update:_)
So make sure type is the correct and set to accept the values you are passing.

Nillable/throwing convenience initializer causing Core Data problems?

I have a Core Data model with an entity whose parent is an abstract entity. The implementations of the classes are in Swift. There is a single property and a single relationship established in the abstract entity, with some other properties and a relationship on the concrete entity.
I'm hitting a strange issue now. When I add a nillable convenience initializer (public convenience init?) or a throwing one (public convenience init(...) throws) to the concrete entity, I start getting an NSInvalidArgumentException like so:
-[MyModel.ConcreteEntity setAbstractAttribute:]: unrecognized selector sent to instance 0x7aa75a10
When I I remove the ? and throws from the signature, I don't get that exception. What can I do to allow this?

How to use an object constructor to initialize values on a PFObject subclass in Swift

Question regarding Swift and PFSubclassing. I have a class called WeatherNotification which is a subclass of PFObject. My class contains an init method that lets me set values when creating the object.
init(temp: Int) {
self.temp = temp
}
However the compiler complains that I don't have super.init in there before I try and initialize a variable.
When I put super.init() in there above the self.temp line then I get a complaint at runtime.
weatherNotification.swift: 39: 7: fatal error: use of unimplemented
initializer 'init()' for class 'perfectweather.WeatherNotification
Is there a different object initializer approach i need to use here? Do I need to switch to initializing via the properties?
Xcode 6.3.2 is being used. Parse API 1.7.5 is the parse api version
EDIT: I ended up switching from an init method to a setValues method which would take in the values I wanted to set on the object. That got me away from the init issues. However, I would like to understand what happened better so I'm leaving the question open!

odd warning with Core Data in iOS 5

I get the following warning when I run my app in iOS5
CoreData: warning: Relationship properties should be #dynamic, not ivars (entity foo, class foo, property bar). This will be an error in the future.
the property bar is being declared in the class as #dynamic. I would like to fix this before it becomes "an error in the future".
You should be using the Xcode to generate your MO subclasses. You will not see this error from the classes generated by the IDE.

iPhone Coredata saving error

I'm trying to create core data application.
Some times when trying to save data, i'm seeing following error:
Error: NSInvalidArgumentException,
Reason: * -_referenceData64 only defined for abstract class. Define -[NSTemporaryObjectID_default _referenceData64]!,
Description: * -_referenceData64 only defined for abstract class. Define -[NSTemporaryObjectID_default _referenceData64]!
I didn't understand why this error is coming and how to avoid it. Can some one help me please.
Edit: The original answer below is technically correct but doesn't accurately describe the true source of the error. The runtime can't find the correct attribute but the reason it can't find it is because the entity exist in another managed object context. The OP probably never had a _referenceData64 attribute for any of his entities.
See: http://www.cocoadev.com/index.pl?TemporaryObjectIdsDoNotRespondToReferenceData
Original Answer:
You have a class that has an attribute _referenceData64. In the data model, that class is marked as "abstract'. Select the entity in data model editor and check the box below that says "abstract". If it is checked, then that is your problem.
An abstract entity is never instantiated. Unless is has a subclass, you can't actually set its attributes to any value. Abstract entities just exist to provide templates for subclasses.