- 
		打开Project
 
	- 
		选择target,进入Build Phases
 
	- 
		点击工具栏上Editor->Add Build Phases
 
	- 
		选择Add Run Script Build Phases。
 
	- 
		target的build Phases会多出一项Run Script 
 
    添加下述代码,注意要保证这段代码在编译过程的最后一步执行。
	
git status
version=$(git describe --tags --dirty)
echo version: $version
info_plist=$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.app/Info.plist
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $version" $info_plist
 
      6.   在App中使用下列代码进行调试
 - (void)viewDidLoad {
  [super viewDidLoad];
  NSString *version = [[[NSBundle mainBundle] infoDictionary]
  objectForKey:@"CFBundleVersion"];
  self.versionLabel.text = version;
}