在新建表的時候報這個錯, 這里先源碼如此啊:
NSString *tableNameA = [NSString stringWithFormat:@"messageDetail-%@",msgDetailModel.FromUserName];
打斷點po出來之后是這樣的

image.png
可以看到里面包含了很多中橫線 - , 修改代碼如下
NSString *tableNameA = [NSString stringWithFormat:@"messageDetail-%@",msgDetailModel.FromUserName];
// 去掉FromUserName中的"-", 否則會引起數(shù)據(jù)庫報錯
NSString *tableNameNO = [tableNameA stringByReplacingOccurrencesOfString:@"-" withString:@""];
// RSLog(@"**************%@",tableNameNO);
tableNameA = tableNameNO;
po出來之后的表名是這樣的

image.png
這樣就好了