Plist Array to NSArray no objects

后端 未结 2 380
眼角桃花
眼角桃花 2020-12-18 16:34

So I\'ve searched, and read and have done this successfully before, but am running into a problem with this one.

I have a plist that is an array of strings. I get n

2条回答
  •  时光说笑
    2020-12-18 17:23

    PLists are dictionaries at their heart (notice the tag). Read the file into an NSDictionary, then ask the dictionary for the array using objectforKey: method and the Root key.

    NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:plistPath];
    _brands = [dict objectForKey:@"Root"];
    

提交回复
热议问题