有人知道Cocoa是否有类似于.NET app.config文件的东西吗?我看了nib文件,但我觉得它有点不同?谢谢!
是的,Appname-Info.plist是由Xcode为任何新应用程序创建的。请参见https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/PropertyLists/index.html。
然后,您可以使用以下方法访问属性...
NSBundle* bundle = [NSBundle mainBundle];
NSString* property = [bundle objectForInfoDictionaryKey:@"keyname"];