我有一个Objective-C iOS库,该库使用并提供了第三方静态C库。我的Objective-C源文件之一使用
导入了该库#import <teamspeak/public_errors.h>
,但是Cocoapods生成的xcode目标找不到该标头。
这是我的文件夹的简化结构
这是我的.podspec
文件
Pod::Spec.new do |spec|
spec.name = 'TSKit'
spec.version = '0.1.0'
spec.summary = 'An iOS TeamSpeak client'
spec.description = <<-DESC
TSKit is a Objective-C wrapper around the C TeamSpeak client library.
DESC
spec.homepage = 'https://github.com/JanC/TSKit'
spec.license = { :type => 'MIT', :file => 'LICENSE' }
spec.author = { 'Jan Chaloupecky' => 'jan.chaloupecky@gmail.com' }
spec.source = { :git => 'https://github.com/JanC/TSKit.git', :tag => spec.version.to_s }
spec.ios.deployment_target = '8.0'
spec.frameworks = 'AVFoundation', 'AudioToolbox'
spec.source_files = 'TSKit/Classes/**/*'
spec.ios.vendored_library = 'TSKit/lib/libts3client.a'
spec.libraries = "ts3client", 'c++'
spec.preserve_paths = 'TSKit/include/**'
# spec.header_dir = "TSKit/include"
# spec.header_mappings_dir = 'TSKit/include'
spec.pod_target_xcconfig = {"HEADER_SEARCH_PATHS" => "$(PODS_ROOT)/#{spec.name}/include/**"}
end
如您所见,我尝试同时使用spec.header_dir
和spec.header_mappings_dir
,但没有任何运气。
pod lib lint
失败:
-> TSKit (0.1.0)
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
- NOTE | xcodebuild: note: Using new build system
- NOTE | [iOS] xcodebuild: note: Planning build
- NOTE | [iOS] xcodebuild: note: Constructing build description
- NOTE | [iOS] xcodebuild: warning: Skipping code signing because the target does not have an Info.plist file. (in target 'App')
- NOTE | [iOS] xcodebuild: 10:9: fatal error: 'teamspeak/public_errors.h' file not found
您可以在此处找到示例项目(一定要检查so-question
分支)
答案 0 :(得分:0)
spec.header_mappings_dir = 'TSKit/include/**/*.h'
应该使cocoapods递归遍历子文件夹teamspeak
并找到public_error.h
头。