self.title=@"復(fù)雜對象歸檔";Person*personA=[[Personalloc]init];personA.name=@"張三";personA.age=20;personA.sex=@"男";Person*personB=[[Personalloc]init];personB.name=@"李四";personB.age=15;personB.sex=@"女";Person*personC=[[Personalloc]init];personC.name=@"王五";personC.age=30;personC.sex=@"男";NSString*paths=[NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask,YES)firstObject];NSLog(@"Caches:%@",paths);NSMutableArray*personsArr=[NSMutableArrayarrayWithObjects:personA,personB,personC,nil];NSString*personsArrPath=[pathsstringByAppendingString:@"/personsArr.plist"];[personsArrwriteToFile:personsArrPathatomically:YES];NSLog(@"%@",personsArrPath);代碼如上,我想要歸檔一個Model數(shù)組,應(yīng)該如何編寫?
iOS 如何歸檔一個Model數(shù)組
手掌心
2019-04-14 10:42:20