我必须这样做是简单易懂的,但不能在网上找到一个基本的例子。 我如何利用Mac Ruby在我的项目中读取一份清单数据?
Solution:
Turns out there s a few different ways to do it, but the cleanest I ve found (so far) is to use the MacRuby helper method load_plist
(which turns a plist file s contents into a hash). Also, if you re using XCode, you will need to get the file path relative to your app bundle:
# there s an AppConfig.plist file in my app bundle
config_path = NSBundle.mainBundle.pathForResource( AppConfig , ofType: plist )
@config = load_plist File.read(config_path)