iOS: Access app-info.plist variables in code

前端 未结 5 1524
-上瘾入骨i
-上瘾入骨i 2020-11-28 23:21

I am working on a Universal app & would like to access the values stored in app-info.plist file in my code.

Reason: I instantiate a UIViewController dynamically

5条回答
  •  甜味超标
    2020-11-29 00:15

    You can also use the infoDictionary method on NSBundle:

    NSDictionary *infoPlistDict = [[NSBundle mainBundle] infoDictionary];
    NSString *version = infoPlistDict[@"CFBundleVersion"];
    

提交回复
热议问题