1、需求说明
2、操作步骤
-
2.2 点击加号,选择New Run Script Phase
-
2.3 为了便于识别,双击重命名为 Dynamic Build Version
#!/bin/bash
buildNumber=$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "${$(SRCROOT)}/${INFOPLIST_FILE}")
buildNumber=`date +"%Y%m%d%H%M"`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
// app build版本
NSString *app_build = [infoDictionary objectForKey:@"CFBundleVersion"];
NSLog(@"app_build == %@", app_build);
- 至此,工程中也可以看到的编译版本被修改了