Class: Pindo::IpaResignHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/pindo/module/xcode/ipa_resign_helper.rb

Class Method Summary collapse

Class Method Details

.resign_ipa(ipa_file_path: nil, bundle_id:) ⇒ String?

重签名 IPA 文件的主入口方法

Parameters:

  • ipa_file_path (String) (defaults to: nil)

    IPA 文件路径(可选,如果为 nil 则自动查找当前目录下的 IPA)

  • bundle_id (String)

    新的 Bundle ID

Returns:

  • (String, nil)

    重签名后的 IPA 文件路径,失败返回 nil



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/pindo/module/xcode/ipa_resign_helper.rb', line 15

def resign_ipa(ipa_file_path: nil, bundle_id:)
    ipa_path = find_ipa_file(ipa_file_path)

    if ipa_path.nil? || ipa_path.empty?
        puts "未找到 IPA 文件"
        return nil
    end

    # 准备重签名的 IPA(修改 Bundle ID)
    resigned_ipa_path = prepare_resign_ipa(ipa_name: ipa_path, bundle_id: bundle_id)

    if resigned_ipa_path.nil?
        puts "准备重签名 IPA 失败"
        return nil
    end

    # 使用新证书签名
    sign_ipa_with_new_cert(ipa_name: resigned_ipa_path, bundle_id: bundle_id)

    resigned_ipa_path
end