iOS开发读取plist内容

ios开发中会用到plist保存数据,读取plist数据只需要一行代码就行:

NSArray * appInfos = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"appslist" ofType:@"plist"] 

 [NSBundle mainBundle]会返回当前程序的bundle bundle是什么鬼? 

  调用NSBundle的方法-> pathForResource: @"fileName" ofType:@"fileType"  来获取想要加载的plist的路径

  获取到想要加载的plist的路径后就能调用NSArray 的方法->arrayWithContentsOfFile: @"plistPath" 来读取plist里面的数据

原文地址:https://www.cnblogs.com/panxiaochun/p/5024602.html