2

所以你知道项目的“MyNameGoesHere.app”或“MyNameGoesHere.xcodeproj”的部分 - 有没有办法通过objective-c代码获取MyNameGoesHere部分?

我可以从 UIDevice 消息中获取所有类型的设备信息,但我不知道如何获取项目/应用程序名称。

4

2 回答 2

6

CFBundleDisplayName不再起作用了。采用:

NSString *bundleName = [[NSBundle mainBundle]
                         objectForInfoDictionaryKey:@"CFBundleName"];
于 2014-10-23T12:52:23.090 回答
5

您可能正在查看捆绑包的 InfoDictionary。您可以通过以下代码获取应用程序的名称:

NSDictionary *info = [[NSBundle mainBundle] infoDictionary];
NSString *bundleName = [NSString stringWithFormat:@"%@", [info objectForKey:@"CFBundleDisplayName"]];
于 2012-05-10T01:47:31.030 回答