Xcode build phase to copy app file to the Applications directory? - xcode

I'm using Xcode 6 to create Mac OS X applications, and I'd like to create a final build phase that copies the App file to the Applications directory. What's the best way to do this?

Just figured it out - I had to add a Copy Files phase to the end of the Build Phases.
In this phase, I specify Absolute Path: /Applications, and I dragged the product (.app) file to the files list.

Related

unable to take IPA from xcode build step to App Center Distribute step, but Publish Artifact works

I have an xCode build task (version 5) that builds and signs without error. I can then use the publish artificats step to be able to manually download the file from the pipeline.
I need to publish this file to app center though, but even when using the $(Build.ArtifactStagingDirectory)\filename.ipa - it's unable to find the file.
I have tried running a bash script to find the file ls -R, but I haven't been able to locate where the file is placed that the xcode step is building.
Error from App Center:
[error]Error: Cannot find any file based on /Users/runner/runners/2.160.1/work/1/s/filename.ipa
Did you specifically copy or stored the ipa file in folder $(Build.ArtifactStagingDirectory)? the pipeline task would not find the ipa file if it didnot exist in folder your specified.
You can check the archive path parameter for Xcode task. The ipa file is placed in the folder defined in archive path. You can specify a place to store the ipa file. For below example i place the ipa file in folder $(system.defaultworkingdirectory)/archive. Then in the following task I will refer to the ipa file by the path $(system.defaultworkingdirectory)/archive/*.ipa
If you leave the archive path to its default value. You can refer to the ipa file with wild-cards **\*.ipa which means the pipeline will search all the file with ipa extension within current working folder.
You can also check the xcode pipeline example here.

Upload .app file to Hockey app using Jenkins

I have created a job in jenkins for Mac application. I am able to build the app successfully. The problem is I am unable to upload the .app file to Hockey app.
It was described in Hockey Jenkins plugin we need .app.zip (MacOS).
I am unable to create .app.zip file.
How to create such kind of file or is there any other way we can upload the .app to Hockeyapp?
As far as I'm aware, you shouldn't have a .app file — it should be a directory.
Xcode should be able to create both the Something.app directory and a Something.app.zip file.
If you can't find a .app.zip file in the build output, you should be able to create one yourself by zipping the .app directory.
e.g. From Jenkins, you could add an "Execute shell" build step that just does:
cd <app-output-dir>; zip -r9 Something.app.zip Something.app
Then from the HockeyApp plugin, you can choose **/*.app.zip as the file to upload.

Xcode: add files to project in a build phase

In my Xcode project I have a custom build phase which runs a script and downloads some images for use by the app. What I want to do is to automatically add those image to the project during the build. Right now, I have to build once (which downloads the files), and then manually add those files to the project. It works as long as the file names don't change. Instead, I'd like to add all the files in a specific directory to the project.
I've tried setting the Output Files value, as suggested here, like this:
$(PROJECT_DIR)/$(PROJECT_NAME)/External Assets/*
but it doesn't work. Any idea if this can be done?
Create a directory with the .bundle extension. Add this bundle to your app's resources. When the project builds, it will automatically copy every file in the bundle, even if they are changed or added after you first add the bundle to the project.

Create archive without Xcode

I am building an Xcode project from console over ssh (I can use only xcodebuild command), but there are no schemes in the project (user forgot to make schemes shared). xcodebuild allows to pass "archive" parameter only if building scheme (-scheme), but that is not an option for me.
So the question is: is it possible to create archive using only target?
I investigated .xcarchive directory, it contains Info.plist file (which contains information about application), dSYMs directory (containing myapp.dSYM) and Products/Applications (containing myapp.app) directory. I also noted that the file size of binary in .xcarchive's .app is 2 times smaller than in .app that is in Release directory. I guess it is because of code signage.
Can I simply copy files from Release directory (.app and .dSYM) to .xcarchive and create Info.plist there to create archive? Or are there any other steps that I must take?
yes, archives are only folders you can make yourself.
look at ANY archive and try to replicate the folder structure. (changing the appname as required)

How to bundle an openframeworks application in xcode (relative resource linking?)

An trying to get openframeworks to build me my application so that i can open it from anywhere and it will load the needed images from within the apps Resources folder.
I believe this is relative linking?
I have done it before, on an older xcode and oF 61.
To do this i dragged the needed images into the project file on the left and added it to the executable target, with in a 'build phase' -> 'copy files'.
Been trying all sorts of methods, ofSetDataPathRoot() which solved the problem last time isnt working for me this time.
Any ideas/help would be appreciated!
Thanks
First you need to tell xCode to copy your /bin/data directory into your application bundle by adding a build phase:
1. Click on your project in the Project Navigator
2. Select "Build Phases"
3. Toggle open the "Run Script" section and paste in the following:
cp -r bin/data "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources";
Then tell your app where to find the data folder relative to itself within the bundle.
Inside the setup method of your oF app:
ofSetDataPathRoot("../Resources/data/");
ofSetDataPathRoot() should solve this problem. Perhaps you are setting the replacement root path incorrectly?
Try calling ofToDataPath() yourself on a string path and print out the result, then use Terminal and cd inside the .app bundle to check if the path sounds correct. Paths are expressed relative to the location of the actual executable inside the .app bundle, so if the executable is at myApp.app/Contents/MacOS/myApp and the data files are at myApp.app/Contents/Resources then ofToDataPath( "texture.png" ) should return something like ../Resources/texture.png.
You can double-check the current working directory (myApp.app/Contents/MacOS in my example) by calling getcwd(), open up a terminal and type man getcwd for more info on that.
oF now sets data path root and does internal calls to ofToDataPath() by default. What version are you using?
Have you looked inside the product's package contents to make sure your resources are getting copies in the proper build phase?

Resources