尝试保存对象时遇到问题。保存后其属性为空。
我的对象:
@interface Route : DBObject
@property (strong) NSString* content;
@property bool hidden;
@end
测试代码:
[DBAccess setDelegate:self];
[DBAccess openDatabaseNamed:@"test"];
Route * route = [Route new];
route.content = @"test content";
route.hidden = true;
[route commit];
DBResultSet * routes = [[Route query] fetch];
for (Route * r in routes) {
NSLog(@"Route content %@, hidden %d", r.content, r.hidden);
}
po route
提交后给出了这个:
| content | UNKNOWN | Nil value
| Id | NUMBER | 1.000000
| hidden | NUMBER | 0.000000
日志输出:
Route content (null), hidden 0