XCODE 13 创建自己的依赖框架

XCODE 13 create own framework with dependencies

我正在创建具有依赖性的自定义框架(Alamofire、SVGKit、lottie 等)

我的问题是当我创建它并在本地导入时它工作正常但是当我通过 pod 导入时它不起作用。

[![在此处输入图片描述][1]][1]

当我像上图一样导入它时它的工作

然后我创建了如下所示的 podspec 文件,通过了验证,然后我将框架和 podspec 文件推送到 github。

Pod::Spec.new do |s|

 s.name         = "testSDK"
 s.version      = "1.0.0"
 s.summary      = "test"
 s.description  = <<-DESC
       test
               DESC

 s.homepage     = "https://github.com/test/test"
 s.license      = { :type => "MIT", :file => "LICENSE" }
 s.author           = { "john" => "test@test.com" } 
 s.ios.deployment_target = '12.0'
 s.ios.vendored_frameworks = 'testSDK.framework'
 s.source        = { :git => 
 'https://github.com/test/test.git',
         :tag => s.version.to_s
        }
 s.swift_version = '5.0'
 s.exclude_files = "Classes/Exclude"

 s.dependency 'Alamofire', '~> 5.4.1'
 s.dependency 'IQKeyboardManagerSwift', '~> 6.5.6'
 s.dependency 'lottie-ios', '~> 3.2.1'
 s.dependency 'SVGKit', '~> 3.0.0'
 s.dependency 'CocoaLumberjack/Core', '~> 3.7.2'

 s.pod_target_xcconfig = {
 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
 }
 s.user_target_xcconfig = { 
 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' 
 }

  end

然后我安装了 pod 它给出了这个错误

yld[45478]: Symbol not found: 
$s9Alamofire21URLRequestConvertibleP02asB010Foundation0B0VyKFTq
Referenced from: 
/Users/john/Library/Developer/CoreSimulator/Devices/5A694E99-89DA-418E-8BAC- 
19BA00DDDD40/data/Containers/Bundle/Application/FB5D28A0-9089-4428-B32F- 
AA2CCF6EC7CE/ios-sdk-example.app/Frameworks/testSDK.framework/testSDK

Expected in: /Users/john/Library/Developer/CoreSimulator/Devices/5A694E99- 
89DA-418E-8BAC-19BA00DDDD40/data/Containers/Bundle/Application/FB5D28A0-9089-4428- 
B32F-AA2CCF6EC7CE/ios-sdk-example.app/Frameworks/Alamofire.framework/Alamofire
Symbol not found: $s9Alamofire21URLRequestConvertibleP02asB010Foundation0B0VyKFTq

Referenced from: 
/Users/john/Library/Developer/CoreSimulator/Devices/5A694E99-89DA-418E-8BAC- 
19BA00DDDD40/data/Containers/Bundle/Application/FB5D28A0-9089-4428-B32F- 
AA2CCF6EC7CE/ios-sdk-example.app/Frameworks/testSDK.framework/testSDK

Expected in: /Users/john/Library/Developer/CoreSimulator/Devices/5A694E99- 
89DA-418E-8BAC-19BA00DDDD40/data/Containers/Bundle/Application/FB5D28A0-9089-4428- 
B32F-AA2CCF6EC7CE/ios-sdk-example.app/Frameworks/Alamofire.framework/Alamofire 

总结

当在本地导入我的自定义框架时,它的 working.But 来自 github 它不起作用 [1]: https://i.stack.imgur.com/F0OjZ.png

我在我的 test.podspec 文件中添加了以下代码,并使用 podfile 和 podfile.lock 上传到我的 github 地址,它成功了。

s.public_header_files = "test.framework/Headers/*.h"
s.source_files = "test.framework/Headers/*.h"