FatFractal customer forums



Author Topic: Can't Save Data in Core Data, as NSmutableDictionary object comes in response  (Read 2355 times)

rohan.deshmukh

  • Newbie
  • *
  • Posts: 3
    • View Profile
I have stack and item class on FF as well as on Core Data in iOS where as item is garbbag to stack while having syncing process I got NSMutableDictionary instance while retrieving the item class instance exactly why NSMutableDictionary class object comes from where as I have send my item class to FF? but the stack class object saves in MOC but where as item does not.

CONSOLE :-
2014-03-07 12:48:21.367 LikesplashPOC[1937:a0b] getClassFromClazz found className (null) for clazz (null)
2014-03-07 12:48:21.367 LikesplashPOC[1937:a0b] getClassFromClazz:(null) returning (null)
2014-03-07 12:48:21.367 LikesplashPOC[1937:a0b] clazzToClassDict is {
    LSItem = LSItem;
    LSStack = LSStack;
}
2014-03-07 12:48:21.368 LikesplashPOC[1937:a0b] class in createInstanceOfClass NSMutableDictionary]

[deleted]
« Last Edit: March 08, 2014, 09:15:29 AM by gkc »

gkc

  • Administrator
  • *****
  • Posts: 375
    • View Profile
Hi Rohan,

Your problem is, I think, to do with 'class mapping. See here for details: http://www.fatfractal.com/prod/linked_files/FF-IOS-Framework-Docs/html/interface_fat_fractal.html#a03c949777eeb19b97009c186feec9b96

If you don't have a class called 'LSItem' then the deserializer won't be able to figure out what class of object to create

Are you calling the registerClass:forClazz: method anywhere in your code?

rohan.deshmukh

  • Newbie
  • *
  • Posts: 3
    • View Profile
Hi Gary,

I have already use registerClass:forClazz: method and register the classes. Still it NSMutableDictionary comes in response

Thanks for response.

gkc

  • Administrator
  • *****
  • Posts: 375
    • View Profile
Ok I think I see what's happening. This message:
        2014-03-07 12:48:21.367 LikesplashPOC[1937:a0b] getClassFromClazz found className (null) for clazz (null)
is being produced while processing the rawJsonDataFromServer field - and in that case it is correctly de-serializing to a dictionary

You problem lies elsewhere ...

If you want to email me some code then I'm happy to take a look ...
« Last Edit: March 08, 2014, 09:16:07 AM by gkc »

nikhil.kavimandan

  • Newbie
  • *
  • Posts: 11
    • View Profile
Hi Gary,

I just e-mailed you the code on Rohan's behalf. Thanks for taking a look.

Nikhil

drdaz7

  • Newbie
  • *
  • Posts: 34
    • View Profile
I'm experiencing similar output here...

Code: [Select]
2014-03-13 19:28:59.765 Refresh[37139:60b] getClassFromClazz found className (null) for clazz Merchant
2014-03-13 19:28:59.765 Refresh[37139:60b] getClassFromClazz:Merchant returning Merchant
2014-03-13 19:28:59.765 Refresh[37139:60b] clazzToClassDict is {
}
2014-03-13 19:28:59.766 Refresh[37139:60b] CoreData: error: Failed to call designated initializer on NSManagedObject class 'Merchant'
2014-03-13 19:28:59.766 Refresh[37139:60b] ERROR: Failed to get real class for NSManagedObject with entity description (null)
2014-03-13 19:28:59.766 Refresh[37139:60b] setValuesOnObject: Merchant does not have key longitude
2014-03-13 19:28:59.766 Refresh[37139:60b] setValuesOnObject: Merchant does not have key latitude
2014-03-13 19:28:59.766 Refresh[37139:60b] setValuesOnObject: Merchant does not have key offers
2014-03-13 19:28:59.767 Refresh[37139:60b] setValuesOnObject: Merchant does not have key name
2014-03-13 19:28:59.767 Refresh[37139:60b] ERROR: Failed to get real class for NSManagedObject with entity description (null)
2014-03-13 19:28:59.767 Refresh[37139:60b] Loading refs for obj <Merchant: 0xaae0dc0> (entity: (null); id: (null) ; data: {
}), props {
}, refs (null), loadFromCacheOnly 0
2014-03-13 19:28:59.767 Refresh[37139:60b] ERROR: Failed to get real class for NSManagedObject with entity description (null)
2014-03-13 19:28:59.768 Refresh[37139:60b] Loading blobs for obj <Merchant: 0xaae0dc0> (entity: (null); id: (null) ; data: {
}), props {
}, refs (null), loadFromCacheOnly 0

This is in the flow of an XCTest. The test bombs when I try to access a property on the returned Merchant object. When I'm debugging, trying to access the same property yields this error:

Code: [Select]
error: Execution was interrupted, reason: Attempted to dereference an invalid ObjC Object or send it an unrecognized selector.
Can anybody give me a clue? :)

gkc

  • Administrator
  • *****
  • Posts: 375
    • View Profile
Hey - your problem is this:
Quote
2014-03-13 19:28:59.766 Refresh[37139:60b] CoreData: error: Failed to call designated initializer on NSManagedObject class 'Merchant'

See CoreData sample code here: https://github.com/gkc/fatfractal-code-samples/tree/master/TaggedLocations



 

Copyright © FatFractal customer forums