Read binary plist into NSDictionary

前端 未结 2 560
刺人心
刺人心 2020-12-20 00:04

Is there simple way to parse the binary plist file into the NSDictionary representation? I am searching something like that:

NSString* strings = [NSString st         


        
2条回答
  •  粉色の甜心
    2020-12-20 00:44

    Considering a file called DataStorageFile.plist, you can use:

    NSString *dataPath = [[NSBundle mainBundle] pathForResource:@"DataStorageFile" ofType:@"plist"];
    self.data = [NSDictionary dictionaryWithContentsOfFile:dataPath];
    

    If you want an array:

    self.data = [NSArray arrayWithContentsOfFile:dataPath];
    

提交回复
热议问题