试图在 cocoapod 中包装供应商框架,但编译器找不到 headers
Trying to wrap vendor framework in cocoapod but the compiler can't find headers
希望有人已经解决了这个问题;我正在尝试将 third-party 库 (Airwatch) 包装在 cocoapod 中,以便更好地管理我们的应用程序。不过,我正在努力让它发挥作用。我已经围绕一个静态库创建了一个 pod,但这个是一个动态框架,我很难编译它。框架中的 headers 在包含的应用程序中无法访问....
这是我已经尝试过的方法:
- 当我在 podspec 中设置 vendored_libraries 时,我似乎无法访问 headers引号或 <>。 Xcode 只是抱怨 'Not Found'
接下来,我尝试在框架中添加 headers 的路径作为 source_files 就像这样
s.source_files = 'Pod/Classes/**/*','Pod/Framework/AWSDK.framework/Versions/A/Headers/*.h'
这允许 xcode 找到 header 用于导入,例如:
import "AWSDKCore.h" //Documented as the framework's main header
但这会引发原始框架内现有导入的错误:
我认为这是个坏主意,但我想我会尝试将我的 cocoapod 命名为与框架相同的名称(应该保留导入路径)。所以,这会抛出一堆错误,说一些枚举要么没有声明,要么声明了两次。
如果有人有想法,我将永远感激...
仅供参考,这是我的 podspec:
Pod::Spec.new do |s|
s.name = "AirwatchSDK"
s.version = "0.1.0"
s.summary = "A short description of AirwatchSDK."
s.homepage = "https://github.com/<GITHUB_USERNAME>/AirwatchSDK"
s.license = 'MIT'
s.author = { "xxxxx" => "xxxx" }
s.source = { :git => "https://github.com/<GITHUB_USERNAME>/AirwatchSDK.git", :tag => s.version.to_s }
s.platform = :ios, '8.0'
s.requires_arc = true
#s.module_name = 'AWSDK'
s.source_files = 'Pod/Classes/**/*','Pod/Framework/AWSDK.framework/Versions/A/Headers/*.h'
s.vendored_frameworks = 'Pod/Framework/AWSDK.framework'
s.frameworks = 'CFNetwork','CoreData','CoreFoundation','CoreGraphics','CoreLocation','CoreTelephony','CoreText'
s.libraries = 'stdc++','z','sqlite3','c++'
end
自从我想出了自己的答案后,我想我会 post 在这里为下一个人...
事实证明,关键是不要 'source_files'(或将其注释掉)。我不确定这是否是错误,但我最终的 podspec 设置了 vendored_framework 而 source_files 没有像这样设置:
#can't have source files if you want to access vendor framework
#s.source_files = 'Pod/Classes/**/*'
# airwatch framework.
s.vendored_frameworks = 'AWSDK.framework'
希望有人已经解决了这个问题;我正在尝试将 third-party 库 (Airwatch) 包装在 cocoapod 中,以便更好地管理我们的应用程序。不过,我正在努力让它发挥作用。我已经围绕一个静态库创建了一个 pod,但这个是一个动态框架,我很难编译它。框架中的 headers 在包含的应用程序中无法访问....
这是我已经尝试过的方法:
- 当我在 podspec 中设置 vendored_libraries 时,我似乎无法访问 headers引号或 <>。 Xcode 只是抱怨 'Not Found'
接下来,我尝试在框架中添加 headers 的路径作为 source_files 就像这样
s.source_files = 'Pod/Classes/**/*','Pod/Framework/AWSDK.framework/Versions/A/Headers/*.h'
这允许 xcode 找到 header 用于导入,例如:
import "AWSDKCore.h" //Documented as the framework's main header
但这会引发原始框架内现有导入的错误:
我认为这是个坏主意,但我想我会尝试将我的 cocoapod 命名为与框架相同的名称(应该保留导入路径)。所以,这会抛出一堆错误,说一些枚举要么没有声明,要么声明了两次。
如果有人有想法,我将永远感激...
仅供参考,这是我的 podspec:
Pod::Spec.new do |s|
s.name = "AirwatchSDK"
s.version = "0.1.0"
s.summary = "A short description of AirwatchSDK."
s.homepage = "https://github.com/<GITHUB_USERNAME>/AirwatchSDK"
s.license = 'MIT'
s.author = { "xxxxx" => "xxxx" }
s.source = { :git => "https://github.com/<GITHUB_USERNAME>/AirwatchSDK.git", :tag => s.version.to_s }
s.platform = :ios, '8.0'
s.requires_arc = true
#s.module_name = 'AWSDK'
s.source_files = 'Pod/Classes/**/*','Pod/Framework/AWSDK.framework/Versions/A/Headers/*.h'
s.vendored_frameworks = 'Pod/Framework/AWSDK.framework'
s.frameworks = 'CFNetwork','CoreData','CoreFoundation','CoreGraphics','CoreLocation','CoreTelephony','CoreText'
s.libraries = 'stdc++','z','sqlite3','c++'
end
自从我想出了自己的答案后,我想我会 post 在这里为下一个人...
事实证明,关键是不要 'source_files'(或将其注释掉)。我不确定这是否是错误,但我最终的 podspec 设置了 vendored_framework 而 source_files 没有像这样设置:
#can't have source files if you want to access vendor framework
#s.source_files = 'Pod/Classes/**/*'
# airwatch framework.
s.vendored_frameworks = 'AWSDK.framework'