iOS Stackmob SDK(2.0.0)(关系)Bug [英] iOS Stackmob SDK(2.0.0) (relationships) Bug

查看:34
本文介绍了iOS Stackmob SDK(2.0.0)(关系)Bug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了关系中的一个严重错误.保存在块saveOnSuccess"中后,我尝试为我的 SMUserManagedObject 设置关系,并出现日志崩溃:

I have found a critical bug with relationships. I try to set relationship for my SMUserManagedObject after saving in the block "saveOnSuccess" and have a crash with a log:

* 由于未捕获的异常SMExceptionIncompatibleObject"而终止应用程序,原因:未找到映射到 StackMob 上主键的实体用户的属性.属性名称应与以下格式之一匹配:lowercasedEntityNameId 或lowercasedEntityName_id.如果 User 的托管对象子类继承自 SMUserManagedObject,这意味着它旨在定义用户对象,则您可以返回上述格式或任何带有可选下划线的小写字符串与 StackMob 上的主键字段匹配.看起来像:

* Terminating app due to uncaught exception 'SMExceptionIncompatibleObject', reason: 'No Attribute found for entity User which maps to the primary key on StackMob. The Attribute name should match one of the following formats: lowercasedEntityNameId or lowercasedEntityName_id. If the managed object subclass for User inherits from SMUserManagedObject, meaning it is intended to define user objects, you may return either of the above formats or whatever lowercase string with optional underscores matches the primary key field on StackMob.' It's looks like:

NSManagedObjectContext *context = [[[SMClient defaultClient] coreDataStore] contextForCurrentThread];
User *user = [[User alloc] initNewUserInContext:context]; 
[user setUsername:@"username1"];
[context saveOnSuccess:^{
user.group = group; //an already created object <--- Have a crash
} onFailure:^{
}];

在此之后,我的组"模式被破坏了.任何尝试都是失败的.如果我尝试在任何其他地方设置类似:

After this my "Group" schema is spoiled. Any attempts is failure. If I try to set in any other place something like:

user.group = group; //Before using saveOnSuccess trick this line work perfectly!

我崩溃了.然后我需要在stackmob架构配置"中删除组"方案进行修复.因此,我无法创建具有预设关系的用户对象.

I have a crash. Then I need to remove "Group" scheme at stackmob "Schema Configuration" for repair. So, I can't create an user object with presetted relationship.

推荐答案

我找到了一个解决方案:在我的 AppDelegate 行中SM_CACHE_ENABLED = YES"使崩溃...

I found a solution: in my AppDelegate line "SM_CACHE_ENABLED = YES" make the crash...

这篇关于iOS Stackmob SDK(2.0.0)(关系)Bug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆