小编All*_*lan的帖子

使用ANT更新内部版本号并注入源代码

在我的build.xml文件中,我正在增加属性文件中的构建版本号,如下所示:

<target name="minor">
     <propertyfile file="build_info.properties">
         <entry key="build.minor.number" type="int" operation="+" value="1" pattern="00" />
         <entry key="build.revision.number" type="int" value="0" pattern="00" />
     </propertyfile>
</target>
Run Code Online (Sandbox Code Playgroud)

我也有类似的主要和修订条目.(来自Build号码:major.minor.revision)

这非常有效.现在我想采用这个递增的内部版本号并将其注入我的源代码中:

    //Main.as
    public static const VERSION:String = "@(#)00.00.00)@";
Run Code Online (Sandbox Code Playgroud)

通过使用:

<target name="documentVersion">
    <replaceregexp file="${referer}" match="@\(#\).*@" replace="@(#)${build.major.number}.${build.minor.number}.${build.revision.number})@" />
</target>
Run Code Online (Sandbox Code Playgroud)

现在这种方式有效.它确实取代了版本,使用了过时的版本号.因此,每当我运行ANT脚本时,build_info.properties都会更新为正确的版本,但我的源代码文件正在使用预先更新的值.

我已回应检查确实在调用替换之前我正在增加内部版本号并且我注意到了回显:

<echo>${build.minor.number}</echo> 
//After updating it still shows old non updated value here but the new value in the property file.
Run Code Online (Sandbox Code Playgroud)

那么有没有办法检索属性文件中的更新值,以便我可以使用它来注入我的源代码?

干杯

ant build-process

10
推荐指数
1
解决办法
8114
查看次数

使用NSMutableArray的iphone EXC_BAD_ACCESS

好的,我有一个UIViewTable和一个带有两个范围按钮的UISearchBar.我的想法是,当我按下范围按钮时,UIViewTable的数据源会发生变化,但我收到EXC_BAD_ACCESS错误.

我的UIViewController SearchViewController.m中有以下代码:

- (void)searchBar:(UISearchBar *)searchBar selectedScopeButtonIndexDidChange: (NSInteger) selected scope
{
    MyAppDelegate *delegate = (MyAppDelegate *) [[UIApplicationsharedApplication] delegate];
    if (self.listData != nil) {
        [self.listData release];
    }
    if (selectedScope == 0) {
        self.listData = [delegate.data getListOne];
    }
    else {
        self.listData = [delegate.data getListTwo];
    }
}

- (void) viewDidLoad {
    MyAppDelegate *delegate = (MyAppDelegate*) [[UIApplication sharedApplication] delegate];
    self.listData = [delegate.data getListOne];

    //some other unrelated code
}
Run Code Online (Sandbox Code Playgroud)

在我的SearchViewController.h我有:

@property (nonatomic,retain) NSMutableArray *listData;
Run Code Online (Sandbox Code Playgroud)

在我的Data.m中,我有:

-(NSMutableArray *) getListOne {
     NSMutableArray *list = [[NSMutableArray alloc] initWithObjects:@"test1", …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c

5
推荐指数
1
解决办法
6080
查看次数

标签 统计

ant ×1

build-process ×1

iphone ×1

objective-c ×1