Force code signing update in Xcode

In our environment, we divide resources into several projects and platforms. When creating for the iPhone, only a fraction of these resources is required. Since this subset is still significant, we have a manifest file that lists what happens, which limits the copy. We have our own Python script that makes a copy, updating only those files that have changed.

I did a Run script phase in Xcode to invoke this script, but I have a few questions related to the code signing phase.

Since we are using a separate manifest file, my Run script Phase cannot specify any input / output file in the Xcode GUI: it varies depending on what was in the directories at that time. A side effect of this is that Xcode does not strictly know which files will be copied (something happens β€œunder the cover”, so to speak).

The problem is that if I only modify resource files between assemblies, rebuilding my application will correctly call my script, which copies the corresponding files, only Xcode will not restart the code signing step and will not copy my application to its device.

I found this to be strange considering that my resource files are indeed listed in the <app_bundle>/_CodeSignature/CodeResources , but it seems like Xcode defines independent rebuild requirements (probably only the files listed in the project file), which understandably.

I tried to play tricks by touching my application directory or the application binary itself, but it does not work. Touching the application directory does not look like touching the binary will work, but NOT FOR CURRENT BUILDING, only the following (since no input file requires recompilation, Xcode does not report that a new binary file is not generated, but the next time, it will indeed detect that the binary has been affected, and repeat both code signing and c).

However, this is a rather imperfect workaround because:

  • The presence of a double assembly with an error
  • My dSYM file will be restored without the need

Does anyone know of any way to force the code signing step in Xcode (from a Run script or elsewhere)?

+4
iphone xcode
source share
1 answer

You can call codes directly from the command line or shell script, for example.

 codesign -f -s "iPhone Distribution" --entitlements Entitlements.xcent -vv location/MyApp.app/MyApp 

Run man codesign to learn about usage.

You can find all the internal commands that are run by viewing the detailed build result in Xcode. Go to the "Assembly" tab, then click the small icon in the lower left corner of the window window - the one that looks like text (next to the warning icon). This will show the complete build output in a new area in Xcode.

I created a shell script to call code names directly so that I can re-sign the existing binary using a new certificate and provisioning profile (for example, after updating some graphic elements in binary format).

This turned out to be really complicated, because Xcode does some subtle things as part of its internal build processes (one example: Xcode includes a provisioning profile in the resulting binary application, but in the process of changing some of its values, for example, get-task-allow). This meant that I had to write a tool to create the corresponding .xcent file from the provisioning profile, depending on whether the Development / Distribution / App Store assembly was running. I hope none of this affects you ...

0
source share

All Articles