在這裏,我粘貼我的代碼,我想從我的test-Info.plist中檢索Bundle版本。如何從iPhone中的項目test-Info.plist中檢索標籤中的Bundle版本?
@interface testViewController : UIViewController {
UILabel *label;
}
@property(nonatomic,retain) IBOutlet UILabel *label;
@end
@implementation testViewController
@synthesize label;
- (void)viewDidLoad {
[super viewDidLoad];
NSString *path = [[NSBundle mainBundle] pathForResource:@"test-info" ofType:@"plist"];
NSString *versionString = [NSString stringWithFormat:@"v%d", [plistData objectForKey:@"Bundle version"]];
label.text = versionString;
}
@end
但我仍得到了空值在那裏我錯了
你真的應該只發布與你的問題相關的那部分代碼 - 很難瀏覽上百行代碼來找到它... – Vladimir 2010-04-20 13:48:58
另外檢查這個問題:http://stackoverflow.com/questions/2657477/how-to-check-bundle-version-for-our-application-by-programming/2657500 – Vladimir 2010-04-20 13:53:58
可能的重複[如何閱讀從PList的捆綁版本?](http://stackoverflow.com/questions/2244985/how-to-read-the-bundle-version-from-plist) – 2016-12-26 15:36:19