Sign iOS dylib before building

572 views Asked by At

I have a C++ library in my hands that needs to be compiled in a form of .dylib for iOS. I have used iOS-cmake and that tool has built a library and created Xcode solution where I can find the library in targets section.

So I open Xcode solution, choose the target and hit Build which results in an error:

Signing for "my_library" requires a development team. Select a development team in the Signing & Capabilities editor.

The problem here is that library targets in Xcode doesn't have Signing option. Target config contains only these tabs:

enter image description here

So my question is - how to get around that? Can I sign a library target using Run Script?

Please advise me how to approach this task. Thank you in advance!

1

There are 1 answers

0
Teja On

There are multiple ways to solve this problem.

  1. You sign the library manually everytime after building the library with iOS-cmake using codesign command by providing appropriate signing identity. This involves lot of manual work, so I would prefer you to go with approach 2
  2. You can automatically sign all the included libraries using run script by adding below command codesign -f -s "$EXPANDED_CODE_SIGN_IDENTITY" "$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/<library_name>" Here signing identity can be either "$EXPANDED_CODE_SIGN_IDENTITY" or "$CODE_SIGN_IDENTITY", it depends on your workspace structure if you are using cocoapods or not

The idea in the second approach is, xcode (xcodebuild) provides few environment variables while building the project, so we try to leverage the same signing identity which was used for signing the application to sign the library