Question

I'm trying to set my build version and build date in my app in settings bundle following this tutorial.

But I keep getting this error no matter what:

line 9: File Doesn't Exist, Will Create: /Volumes/Work Invalid Arguments + 1: syntax error: invalid arithmetic operator (error token is "'t Exist, Will Create: /Volumes/Work Invalid Arguments + 1") Command /bin/sh failed with exit code 1

Could somebody please help me....

Thanks in advance.

Was it helpful?

Solution

Ok , I found the mistake : when we post, revers quotes are use to formate the message. So, please replace all by a reverse quote `

echo "#define BUILD_DATE @\"date "+%d/%m/%Y %H:%M"\"" > build.h

build, and check your build.h

OTHER TIPS

My solution is to create a build.h header with the build date (build version is related to build date), and use this from my app to display the App version + build date.

Of course, build.h need to be refresh each time you build your App.

So, here is how I do this :

Select your Targets (where you can set Bundle ID ...) / Build Phases. Go to menu Editor/Add Build Phase/Add Run Script Build Phase. Move the new created line (Run Script) up to the line "Compile sources" (use drag&drop). open the line "Run script", and replace Type a script... with :

echo "#define BUILD_DATE @\"date "+%d/%m/%Y %H:%M"\"" > build.h

Now each time you will build, build.h will be re-create.

So, now you need to build => you will have your 1st build.h avail at root of your project. Add it to your project.

Now, import build.h in the VC where you need the information.

Here is how I use it (I have a iboultet to a label)

- (void)viewDidLoad
{
    [super viewDidLoad];

    //cf http://stackoverflow.com/questions/3015796/how-to-programmatically-display-version-of-target-in-iphone-app-xcode
    NSString * appVersionString = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];

    self.version.text = [NSString stringWithFormat:@"v %@  %@", appVersionString,BUILD_DATE];

}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top