Getting data from the Info plist

后端 未结 3 2044
梦谈多话
梦谈多话 2021-02-05 12:58

Whenever I want to get data from a plist file I use the following code:

NSString *filePath = [[NSBundle mainBundle] pathForResource:@\"FILE_NAME\" ofType:@\"plis         


        
3条回答
  •  借酒劲吻你
    2021-02-05 13:56

    From an earlier SO answer of mine. Attributes from the info.plist for your project are directly accessible by the following...

    [[NSBundle mainBundle] objectForInfoDictionaryKey:key_name];
    

    Your filePath is nil simply because it can't find the file - check spellings & check if the file you are trying to read from is actually in the bundle etc.

提交回复
热议问题