I've been using firebase successfully to read and write data for an iOS app. Now I'm starting to need to store and retrieve more complex objects. I want to make sure I'm proceeding in the correct manner.
I've got a class such as,
@interface MyClass : NSObject
@property (strong, nonatomic) NSString *name;
@property (strong, nonatomic) NSString *id;
@end
When I write this class into firebase,
MyClass *myClass1 = [[MyClass alloc] init];
myClass1.name = @"Bakery";
myClass1.id = @"1";
[firebase setValue:myClass1];
An exception is thrown,
'Unknown class in payload: MyClass; only NSDictionary and NSArray supported.'
I see in the iOS firebase docs that NSNumber, NSString, NSArray and NSDictionary are listed as the types the setValue: can handle.
Does this mean I can't use setValue:on my classes? Do I need to unwrap my objects into instances of the NSNumber, NSString, NSArray or NSDictionary objects to store data? I was thinking that the iOS firebase implementation would be able to serialize simple objects to save to firebase.