【发布时间】:2015-08-16 23:35:40
【问题描述】:
我创建了一个包含两个文件的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 的桥接头?
【问题讨论】:
标签: ios objective-c swift cocoapods bridging-header