The name of the Provisioning Profile used to sign the iPhone app?

I wrote a script that uses xcodebuild to create an AdHoc build of an iPhone application.

I would like to edit this script to display the name of the Provisioning Profile used to sign the assembly.
This would enable the Provisioning Profile to be included in the zip, which is automatically generated. Thus, I can automatically send the archive to AdHoc testers and make sure that they have the correct Provisioning Profile for installing the application.

Is there a way to extract the profile profile name or the file used to sign the application :

  • from embedded and signed application
  • from an Xcode project (I don't want to manually parse the project.pbxproj file, as this solution might break in the next Xcode update)
  • any other way that is scriptable

Unforgiven suggested using the security command to get the name of the certificate used to sign the application. Once you get this information, is there a way to find the name of the Provisioning Profile?


Here is what I tried:

Unfortunately, the output of xcodebuild during build does not contain this information. The CodeSign step has a line:

  / usr / bin / codesign -f -s "iPhone Distribution: My name" ... 

but I cannot match this with a certificate.

I learned the use of code and the command

  / usr / bin / codesign -d -vvv --entitlements - -r - /Users/lv/Desktop/TicTacBoo.app/TicTacBoo 
It looked promising, but it does not give me the necessary information.
I also did not find a useful option in xcodebuild.
+4
source share
3 answers

The training profile is already in the app. You do not need another copy in your zip file (unless your testers understand how to use the copy inside the application.)

He called YourApplication.app/embedded.mobileprovision

This does not answer your question because the original file name is lost, however it seems to solve your big problem.

+6
source

You can use the security command from the terminal; unfortunately, at least on my MBP with Snow Leopard, there seems to be a segmentation error in one of the commands that need to be executed. For more information, exit the terminal

 man security 

In any case, here is what you can try, considering that your development / production certificates are stored in the login login chain:

 security unlock-keychain login.keychain; security find-certificate -a -c "iPhone Distribution: Your name" -p > cert.pem; 

The second command raises a segmentation error (caused by the -c argument), but it should be exactly what you need. Alternatively, you can use

 security find-identity -p codesigning -v; 

to get a list of all valid certificates that you can use to encode the signatures of your applications. For each certificate, the output also contains a SHA1 message digest, so you can easily search for a certificate in the key chain corresponding to the SHA1 digest associated with iPhone Distribution: Your Name. This, however, requires you to write your application using keychain APIs.

Let me know if this works on your mac or if you encounter the same segmentation error.

EDIT / UPDATE : I checked the error on other machines and gave an Apple error.

+2
source

How about searching in the plc _CodeSignature / CodeResources (embedded application) file for files like "mobileprovision"?

Here you can do this using the default options (1) to read the plist file. You need to copy the CodeResources file to some file with the suffix ".plist" in order to maintain happy default settings ...

 cp /build/Distribution-iphoneos/MyApp.app/_CodeSignature/CodeResources /tmp/defaults.plist defaults read /tmp/defaults files |grep .mobileprovision |grep -v embedded.mobileprovision 

(in my test case there were .mobileprovision entries, ignore the name with the name "embedded.mobileprovision")

0
source

Source: https://habr.com/ru/post/1302250/


All Articles