我已经创建了一个应用程序,并且已经在我的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
Run Code Online (Sandbox Code Playgroud)
但在我错了的地方,我仍然得到零值