ios把服务器上的数据插到环信demo的数据库,出错了
[[EaseMob sharedInstance].chatManager insertMessagesToDB:array1];
array是一个字典数组
[
{
id = 2121,
filename = ,
status = 1,
msg_id = 82839550610637252,
msg_type = txt,
type = chatmessage,
timestamp = 1436852385910,
url = ,
to_user = 81364249049301408,
secret = ,
lat = 0,
chat_type = groupchat,
ext = null,
lng = 0,
addr = ,
msg = 红,
length = 0,
from_user = 19
},
{
id = 2120,
filename = ,
status = 1,
msg_id = 82839536849125828,
msg_type = txt,
type = chatmessage,
timestamp = 1436852382701,
url = ,
to_user = 81364249049301408,
secret = ,
lat = 0,
chat_type = groupchat,
ext = null,
lng = 0,
addr = ,
msg = 他用,
length = 0,
from_user = 19
},
错误原因
-[__NSCFDictionary conversationChatter]: unrecognized selector sent to instance 0x10af5980
2015-07-27 15:00:12.525 breezeTourism[40993:1322549] NSScanner: nil string argument
2015-07-27 15:00:12.525 breezeTourism[40993:1322549] NSScanner: nil string argument
array是一个字典数组
[
{
id = 2121,
filename = ,
status = 1,
msg_id = 82839550610637252,
msg_type = txt,
type = chatmessage,
timestamp = 1436852385910,
url = ,
to_user = 81364249049301408,
secret = ,
lat = 0,
chat_type = groupchat,
ext = null,
lng = 0,
addr = ,
msg = 红,
length = 0,
from_user = 19
},
{
id = 2120,
filename = ,
status = 1,
msg_id = 82839536849125828,
msg_type = txt,
type = chatmessage,
timestamp = 1436852382701,
url = ,
to_user = 81364249049301408,
secret = ,
lat = 0,
chat_type = groupchat,
ext = null,
lng = 0,
addr = ,
msg = 他用,
length = 0,
from_user = 19
},
错误原因
-[__NSCFDictionary conversationChatter]: unrecognized selector sent to instance 0x10af5980
2015-07-27 15:00:12.525 breezeTourism[40993:1322549] NSScanner: nil string argument
2015-07-27 15:00:12.525 breezeTourism[40993:1322549] NSScanner: nil string argument
没有找到相关结果
已邀请:
6 个回复
Half12345
不轻易言弃
Half12345
不轻易言弃
{
NSDictionary *imageDic = @{EMMessageBodyAttrKeySecret:@"fmIgiuSuEeSdyLffbqYspd3oOH6uMSGkXaOvZUF9ayy5b26c",
EMMessageBodyAttrKeySize:@{EMMessageBodyAttrKeySizeWidth:@laznrbfe,EMMessageBodyAttrKeySizeHeight:@1136},
EMMessageBodyAttrKeyFileName:@"image.jpg",
EMMessageBodyAttrKeyType:EMMessageBodyAttrTypeImag,
EMMessageBodyAttrKeyUrl:@"https://a1.easemob.com/easemob-demo/chatdemoui/chatfiles/7e622080-e4ae-11e4-8a29-c1c8b3fc3a16",
EMMessageBodyAttrKeyFileLength:@178212};
EMImageMessageBody *imageBody = [EMImageMessageBody imageMessageBodyFromBodyDict:imageDic forChatter:_chatter];
EMMessage *image = [[EMMessage alloc] initMessageWithID:@"50152415936119390" sender:_chatter receiver:@"my_test4" bodies:@[imageBody]];
image.timestamp = ([[NSDate date] timeIntervalSince1970] - 10) * 1000;
image.isReadAcked = YES;
image.deliveryState = eMessageDeliveryState_Delivered;
image.isRead = YES;
image.isGroup = self.isChatGroup;
image.conversationChatter = @"my_test5";
NSDictionary *voiceDic = @{EMMessageBodyAttrKeySecret:@"ZTKmSuSxEeS2upsPo9JVK-E7e7W_Ieu6g55uSbYCQikqSmh1",
EMMessageBodyAttrKeyFileName:@"audio chat",
EMMessageBodyAttrKeyDuration:@自由的天天天,
EMMessageBodyAttrKeyType:EMMessageBodyAttrTypeAudio,
EMMessageBodyAttrKeyUrl:@"https://a1.easemob.com/easemob-demo/chatdemoui/chatfiles/6532a640-e4b1-11e4-9a0a-019cf64935ae",
EMMessageBodyAttrKeyFileLength:@8870};
EMVoiceMessageBody *voiceBody = [EMVoiceMessageBody voiceMessageBodyFromBodyDict:voiceDic forChatter:_chatter];
EMMessage *voice = [[EMMessage alloc] initMessageWithID:@"50152415936119490" sender:_chatter receiver:@"my_test4" bodies:@[voiceBody]];
voice.timestamp = ([[NSDate date] timeIntervalSince1970] - 5) * 1000;
voice.isReadAcked = YES;
voice.deliveryState = eMessageDeliveryState_Delivered;
voice.isRead = YES;
voice.isGroup = _isChatGroup;
voice.conversationChatter = @"my_test5";
NSDictionary *videoDic = @{EMMessageBodyAttrKeySecret:@"ANfQauSzEeSWceXUdNLCzOoCWyafJ0jg5AticaEKlEVCeqD2",
EMMessageBodyAttrKeyDuration:@12,
EMMessageBodyAttrKeyThumbSecret:@"AHShyuSzEeS9Eo2-FC-hEqTv7L96P5LNxUCo2zGrbZfu9FWz",
EMMessageBodyAttrKeySize:@{EMMessageBodyAttrKeySizeWidth:@阿密特,EMMessageBodyAttrKeySizeHeight:@90},
EMMessageBodyAttrKeyThumb:@"https://a1.easemob.com/easemob-demo/chatdemoui/chatfiles/0074a1c0-e4b3-11e4-9adb-9da24ed370c3",
EMMessageBodyAttrKeyFileName:@"video.mp4",
EMMessageBodyAttrKeyType:@"video",
EMMessageBodyAttrKeyFileLength:@1235670,
EMMessageBodyAttrKeyUrl:@"https://a1.easemob.com/easemob-demo/chatdemoui/chatfiles/00d7d060-e4b3-11e4-9906-8311a663fa09"};
EMVideoMessageBody *videoBody = [EMVideoMessageBody videoMessageBodyFromBodyDict:videoDic forChatter:_chatter];
EMMessage *video = [[EMMessage alloc] initMessageWithID:@"50152415936119590" sender:_chatter receiver:@"my_test4" bodies:@[videoBody]];
video.timestamp = ([[NSDate date] timeIntervalSince1970] - 1) * 1000;
video.isReadAcked = YES;
video.deliveryState = eMessageDeliveryState_Delivered;
video.isRead = YES;
video.isGroup = _isChatGroup;
video.conversationChatter = @"my_test5";
[[EaseMob sharedInstance].chatManager insertMessagesToDB:@[image, voice, video]];
[[EaseMob sharedInstance].chatManager loadAllConversationsFromDatabaseWithAppend2Chat:YES];
}
Half12345
不轻易言弃