default •

给修改过的 iOS App 重新签名。

修改了 ipa 文件后,签名可能会失效。

检查:

codesign -v /path/to/app

如果签名确实失效了,会有这种提示:

/path/to/app: invalid signature (code or signature have been modified)

解决问题

创建一个证书

  1. 打开 Keychain Access🔑。
  2. Menu -> Certificate Assistant -> Create a Certificate。
  3. Certificate Type 选择 Code signing。
  4. 取消勾选 Let me override defaults
  5. 根据剩余的提示信息完成创建。

进行设置

  1. 侧边栏的 login 里,找到新建的签名,查看更多信息。
  2. 展开 Trust 一栏,Code signing 选择 Always Trust。
  3. 输入密码完成修改。

给 ipa 签名。

codesign -f -s "certificate name" /path/to/app

重新验证签名状态

codesign -v /path/to/app

如果没有任何提示,恭喜你,成功了。

Code signing fails with error 'resource fork, Finder information, or similar detritus not allowed'

This is a security hardening change that was introduced with iOS 10, macOS Sierra, watchOS 3, and tvOS 10.

Code signing no longer allows any file in an app bundle to have an extended attribute containing a resource fork or Finder info.

To see which files are causing this error, run this command in Terminal:

$ xattr -lr <path_to_app_bundle>

replacing <path_to_app_bundle> with the path to your actual app bundle.

Here's an example of this command in action:

$ xattr -lr Foo.app
/Applications/Foo.app: com.apple.FinderInfo:
00000000  00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00  |................|
You can also remove all extended attributes from your app bundle with the xattr command:

$ xattr -cr <path_to_app_bundle>

Note that browsing files within a bundle with Finder's Show Package Contents command can cause Finder info to be added to those files. Otherwise, audit your build process to see where the extended attributes are being added.

💫 Comment 

已有 2 条评论

  1. Annie
    Annie
    2021年06月29日 • 回复

    大佬更 blog 了诶!
    (所以果然还是技术博客(

    1. Metheno
      Metheno
      2021年08月05日 • 回复

      并不。(