Closed Eowyn-Q closed 7 years ago
应该跟 xcode 版本没关系吧。。。
+(EWBUserModel)handleRemoteData:(NSData)responseData save:(BOOL)save { if (responseData == nil || responseData.length <= 0) { return nil; }
EWBUserModel *model = nil;
@try {
//基本信息
model = [responseData toModel:[EWBUserModel class] forKey:RESULT_DATA];
NSDictionary* dic = [NSData dictionaryWithJSONData:responseData];
[EWBUserModel parsingExtensionFromList:model dic:dic save:save];
//保存数据库
if (model != nil && model.userInfo != nil) {
model.uid = model.userInfo.ID;
if (model.companyInfo != nil) {
model.cid = model.companyInfo.ID;
}
//这步存放不进去,外部取不到,但是我在xcode7.3可以,在xocde8就不行,是ios系统版本问题吗
[self saveDataToDB:model];
}
}
@catch (NSException *exception) {
model = nil;
}
@finally {
return model;
}
}
看下日志,insert 失败我会打印日志的
2016-11-22 14:51:51.665 258[8251:70349] value for obj: (null) key: userInfo 2016-11-22 14:51:51.667 258[8251:70349] value for obj: (null) key: companyInfo 2016-11-22 14:51:51.667 258[8251:70349] value for obj: (null) key: syb_level 2016-11-22 14:51:51.668 258[8251:70349] value for obj: (null) key: money 2016-11-22 14:51:51.668 258[8251:70349] value for obj: (null) key: token_id 2016-11-22 14:51:51.668 258[8251:70349] value for obj: (null) key: user_token 2016-11-22 14:51:51.668 258[8251:70349] value for obj: (null) key: have_shop 2016-11-22 14:51:51.669 258[8251:70349] value for obj: (null) key: is_syb 2016-11-22 14:51:51.669 258[8251:70349] value for obj: (null) key: uid 2016-11-22 14:51:51.669 258[8251:70349] value for obj: (null) key: cid 2016-11-22 14:51:51.669 258[8251:70349] value for obj: (null) key: app_token 2016-11-22 14:51:51.669 258[8251:70349] value for obj: (null) key: company 2016-11-22 14:51:51.670 258[8251:70349] value for obj: (null) key: icon 2016-11-22 14:51:51.670 258[8251:70349] value for obj: (null) key: isrelogin 2016-11-22 14:51:51.670 258[8251:70349] value for obj: (null) key: hasChanged 2016-11-22 14:51:51.671 258[8251:70349] value for obj: (null) key: ID 2016-11-22 14:51:51.671 258[8251:70349] value for obj: (null) key: brm_id 2016-11-22 14:51:51.671 258[8251:70349] value for obj: (null) key: username 2016-11-22 14:51:51.671 258[8251:70349] value for obj: (null) key: password 2016-11-22 14:51:51.672 258[8251:70349] value for obj: (null) key: icon 2016-11-22 14:51:51.672 258[8251:70349] value for obj: (null) key: company_name 2016-11-22 14:51:51.672 258[8251:70349] value for obj: (null) key: money 2016-11-22 14:51:51.672 258[8251:70349] value for obj: (null) key: contact 2016-11-22 14:51:51.672 258[8251:70349] value for obj: (null) key: mobile 2016-11-22 14:51:51.672 258[8251:70349] value for obj: (null) key: moblie_certify 2016-11-22 14:51:51.673 258[8251:70349] value for obj: (null) key: email 2016-11-22 14:51:51.673 258[8251:70349] value for obj: (null) key: agent_id 2016-11-22 14:51:51.673 258[8251:70349] value for obj: (null) key: sex 2016-11-22 14:51:51.673 258[8251:70349] value for obj: (null) key: province 2016-11-22 14:51:51.674 258[8251:70349] value for obj: (null) key: city 2016-11-22 14:51:51.674 258[8251:70349] value for obj: (null) key: last_login 2016-11-22 14:51:51.674 258[8251:70349] value for obj: (null) key: system_id 2016-11-22 14:51:51.674 258[8251:70349] value for obj: (null) key: insert_time 2016-11-22 14:51:51.674 258[8251:70349] value for obj: (null) key: update_time 2016-11-22 14:51:51.677 258[8251:70349] value for obj: (null) key: ID 2016-11-22 14:51:51.677 258[8251:70349] value for obj: (null) key: brm_id 2016-11-22 14:51:51.677 258[8251:70349] value for obj: (null) key: uid 2016-11-22 14:51:51.678 258[8251:70349] value for obj: (null) key: company_name 2016-11-22 14:51:51.678 258[8251:70349] value for obj: (null) key: host_url 2016-11-22 14:51:51.678 258[8251:70349] value for obj: (null) key: company_type 2016-11-22 14:51:51.678 258[8251:70349] value for obj: (null) key: logo 2016-11-22 14:51:51.679 258[8251:70349] value for obj: (null) key: business_model 2016-11-22 14:51:51.679 258[8251:70349] value for obj: (null) key: emploees 2016-11-22 14:51:51.679 258[8251:70349] value for obj: (null) key: certify 2016-11-22 14:51:51.679 258[8251:70349] value for obj: (null) key: status 2016-11-22 14:51:51.680 258[8251:70349] value for obj: (null) key: search_sort 2016-11-22 14:51:51.680 258[8251:70349] value for obj: (null) key: domain_key 2016-11-22 14:51:51.680 258[8251:70349] value for obj: (null) key: insert_time 2016-11-22 14:51:51.680 258[8251:70349] value for obj: (null) key: update_time
是这个吗
+(EWBUserModel )handleMJModelRemoteData:(NSData)responseData save:(BOOL)save { if (responseData == nil || responseData.length <= 0) { return nil; }
EWBUserModel *model = nil;
NSDictionary *result = [NSData dictionaryWithJSONData:responseData][@"result_data"];
model = [EWBUserModel mj_objectWithKeyValues:result];
[EWBUserModel parsingMJModelExtensionFromList:model save:save];
//保存数据库
if (model != nil && model.userInfo != nil) {
model.uid = model.userInfo.ID;
if (model.companyInfo != nil) {
model.cid = model.companyInfo.ID;
}
//这样写的话,执行完这步,会崩!!!
[model saveToDB];
}
return model;
}
Debug 系统异常的,应该跟代码无关, 你看下 日志那边有没有 sql 关键字
没有 sql 关键字
你项目看下你能打包 发给我看下
在xcode8.1中我的模型类存和取都失败,但是在xcode7.3中能正常使用,着急啊,能回复一下吗,加了群没人回应,这是我的qq136009372