开发者

Info.plist file missing/Unable to set & retrieve CFBundleVersion from my Cocoa project

开发者 https://www.devze.com 2023-04-11 10:09 出处:网络
I created a new cocoa project using the command-line tool template. I need to be able to set/retrieve the version from the bundle, but the infoDictionary in my mainBundle is only showing three basic i

I created a new cocoa project using the command-line tool template. I need to be able to set/retrieve the version from the bundle, but the infoDictionary in my mainBundle is only showing three basic items when I do po [[NSBundle mainBundle] infoDictionary]:

{ 
    CFBundleExecutableP开发者_Python百科ath = "...";
    NSBundleInitialPath = "...";
    NSBundleResolvePath = "...";
}

I do have a Common-Info.plist file, but changing values in here doesn't seem to affect anything. I've also tried to add an Info.plist to my project, but it's ignored.

Is there something special I need to do to get it using the right file?

This is Xcode 3.2.6

EDIT FOR FIX

The key was to add this to my 'Other linker flags' option in the target/get info:

-sectcreate __TEXT __info_plist Info.plist


You can embed the Info.plist file in a special section of your binary. Daniel Jalkut's blog has some good information on it. Check out the "Embedding Info.plist" section here: http://www.red-sweater.com/blog/2083/the-power-of-plist

0

精彩评论

暂无评论...
验证码 换一张
取 消