Xcode6和Xcode5獲取app名字及國際化的不一樣

1.在Xcode5下,獲取程序名字(app name)的方法爲:html

NSString *proName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];
NSLog(@"dicName ==== %@",[[NSBundle mainBundle] infoDictionary]);

打印以後能夠看到:app

CFBundleDisplayName = TestOfButton;spa

CFBundleName = TestOfButton;code

 

2.在Xcode6下,獲取程序名字(app name)的方法爲:htm

NSString *proName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];NSLog(@"dicName ==== %@",[[NSBundle mainBundle] infoDictionary]);

打印以後能夠看到:string

CFBundleName = TestOfButton;io

沒有了這一鍵值:CFBundleDisplayName = TestOfButton;object

 Xcode6 程序的CFBundleDisplayName能夠在info.plist裏添加這個key。程序

 

3. 說到 Info.plist,在Xcode6中,沒有 info.string 文件,只有 Info.plist 文件,因此,若是作國際化能夠新建一個 Info.string,來彌補Xcode6中 Info.string 的缺失。並且若是要在這裏改app name 則,CFBundleDisplayName 要加上雙引號。而後,剩餘的國際化進行的操做和網上介紹的方法雷同了。若有改動,我會陸續更新。方法

 

原文地址:http://www.th7.cn/Program/IOS/201409/285479.shtml

相關文章
相關標籤/搜索