在构建之前签署 iOS dylib [英] Sign iOS dylib before building

查看:27
本文介绍了在构建之前签署 iOS dylib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我手头有一个 C++ 库,需要为 iOS 以 .dylib 的形式编译.我使用了

所以我的问题是 - 如何解决这个问题?我可以使用 Run Script 对库目标进行签名吗?

请告诉我如何完成这项任务.提前致谢!

解决方案

有多种方法可以解决这个问题.

  1. 您每次使用 codesign 命令使用 iOS-cmake 构建库后,通过提供适当的签名身份手动对库进行签名.这涉及大量手动工作,因此我希望您采用方法 2
  2. 您可以通过添加以下命令使用运行脚本自动签署所有包含的库codesign -f -s "$EXPANDED_CODE_SIGN_IDENTITY";"$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/<library_name>>这里的签名身份可以是$EXPANDED_CODE_SIGN_IDENTITY"或$EXPANDED_CODE_SIGN_IDENTITY".或$CODE_SIGN_IDENTITY",这取决于您是否使用 cocoapods 的工作区结构

第二种方法的想法是,xcode (xcodebuild) 在构建项目时提供很少的环境变量,因此我们尝试利用用于签署应用程序的相同签名身份来签署库

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:

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!

解决方案

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

这篇关于在构建之前签署 iOS dylib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆