我创建了一个包含两个文件的objective-c pod:
Source/SomeViewController.h
Source/SomeViewController.m
我还在 pod 中创建了一个桥接头:
Source/Bridging-Header.h
内容:
#import "SomeViewController.h"
我的 podspec 看起来像这样:
Pod::Spec.new do |s|
s.name = 'TestLib'
s.version = '0.0.1'
s.license = 'MIT'
s.ios.deployment_target = '7.0'
s.source_files = 'Source/*.{h,m}'
s.requires_arc = true
s.xcconfig = { 'SWIFT_OBJC_BRIDGING_HEADER' => 'Source/Bridging-Header.h' }
end
我创建了一个演示项目并pod init
插入了我的 pod。然后在pod install
我得到以下输出后:
安装 TestLib 0.0.1(原为 0.0.1) 生成 Pods 项目 集成客户端项目
[!] The `TestLibProject [Debug]` target overrides the `SWIFT_OBJC_BRIDGING_HEADER` build setting defined in `Pods/Target Support Files/Pods-TestLibProject/Pods-TestLibProject.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `TestLibProject [Release]` target overrides the `SWIFT_OBJC_BRIDGING_HEADER` build setting defined in `Pods/Target Support Files/Pods-TestLibProject/Pods-TestLibProject.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
当我打开TestLibProject.xcworkspace
文件时,我看到 pod 已正确安装,但 pod 中的桥接头未正确安装。我尝试做的 Swift 项目:
let vc: SomeViewController
这会产生错误,因为未安装来自 pod 的桥接头。
我必须如何配置podspec
才能正确安装 pod 的桥接头?