Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a script after Xcode runs codesign on my iPhone app?

I've got a script written which does some steps to package my build for an Ad Hoc distribution. My first guess was to use a run script phase in my Ad Hoc target. But it looks like codesigning is fixed at the last position in the chain of building iPhone apps.

Somebody has a clue how can I run my script at the very last possible moment in the build process?

Update: Look at this answer below on how to run scripts in Xcode 4.

like image 989
Jens Kohl Avatar asked Sep 11 '09 09:09

Jens Kohl


People also ask

How do I check if a script is running in Xcode?

1 Select xcodeproj file of you project -> Select Target -> Select Build Phases -> Click on plus button (upper left corner) -> Select New Run Script Phase. 2If you want to run a script while it is being installed on the device then please check a little checkbox just below the script box.

How do I run a build phase script in Xcode?

Go to the Build Phases section of your project. (Click on the project, then on the main target, then on the “Build Phases” tab along the top.) Click the + at the top left to create a new build phase; choose “New Run Script Phase.” Xcode creates the script at the end of the list, naming it “Run Script.”


2 Answers

A short update on that topic: Since we all use Xcode 4 these days. Apple has refined the process of running scripts on several events in the build process with the introduction of schemes.

Go to ProductEdit Scheme… and expand the Build side bar item, there you have the chance to run scripts before (Pre-actions) and after (Post-actions) a build, a debugging, archiving, etc event. It's pretty handy to set a version number from git describe output or upload .xcarchives to services like TestFlight and HockeyApp.

If you want to share your pre/post scripts with other team members who got access to your code repository, you can go to ProductManage Schemes… and mark your scheme as shared. After you checked in …{project_name}.xcodeproj/xcshareddata/xcschemes/{project_name}.xcscheme to your preferred scm everybody can use it in the project.

like image 184
Jens Kohl Avatar answered Oct 16 '22 10:10

Jens Kohl


Can you create an aggregate target that contains both your "Ad hoc" target and a run script build phase (that runs after the "Ad hoc" target)?

like image 21
Lyndsey Ferguson Avatar answered Oct 16 '22 10:10

Lyndsey Ferguson