怎样将数据储存到本地。比如说最高分,或者排行榜之类的。要是能有Demo就太感谢了!
coredata,sqlite,NSUserDefaults。sqlite存在document路径下即可。
-(void) saveChatHistoty
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentPath = ;
documentPath = ;
NSMutableDictionary *mainDic = nil;
if (! fileExistsAtPath:documentPath])
{
createFileAtPath:documentPath contents:nil attributes:nil];
}
else {
mainDic = ;
}
if (mainDic ==nil) {
mainDic = ;
}
ChatBox *chatBox = ;
NSArray *tempArray =;
NSMutableArray *chatArray = ;
for (unsigned int i = 0; i<; i++) {
Chatting *tmpChat = ;
if (tmpChat.chattingType==0) {
NSMutableDictionary *dic = ;
;
;
;
;
;
;
;
;
;
}
}
;
;
}
我刚写的用plist保存聊天记录的方法 楼主可以参考下