Do Not Think!!!

Posted
Filed under 01010101
1. Info.plist 파일을 수정합니다.
Bundle version 은 메인넘버
Bundle version string, short 는 빌드넘버로 사용합니다.

Bundle version 은 이미 있기 때문에,
Bundle version string, short 만 새로 추가합니다.
(Value = 0)
사용자 삽입 이미지



2. build number 를 자동으로 증가시켜주는 스크립트를 추가합니다.
[code]#!/bin/bash
# Auto Increment Version Script
buildPlist="Info.plist"
CFBuildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" $buildPlist)
CFBuildNumber=$(($CFBuildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $CFBuildNumber" $buildPlist
[/code]
사용자 삽입 이미지


3. 빌드시, debug 모드를 확인하도록 Configuration : Debug 인 경우에만 다음 플래그를 추가합니다.
[code]Other C Flags : -DDEBUG=1
[/code]
사용자 삽입 이미지


4. debug 모드일 경우에만 버전 넘버를 보여주도록 코드를 작성합니다.
[code]#ifdef DEBUG
    NSString *versionNumber = [[[NSBundle bundleForClass:[self class]] infoDictionary] objectForKey:@"CFBundleVersion"];
    NSString *buildNumber = [[[NSBundle bundleForClass:[self class]] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
   
    NSLog(@"build number: %@ - %@", versionNumber, buildNumber);
   
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, 320, 20)];
    label.text = [NSString stringWithFormat:@"build number: %@ - %@", versionNumber, buildNumber];
    label.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:.5];
    label.textColor = [UIColor whiteColor];
    label.font = [UIFont systemFontOfSize:12];
    label.alpha = .5;
    [window addSubview:label];
    [label release];
#endif
[/code]
사용자 삽입 이미지