使用 Swift 从父 pod 导入 Objective-C 供应商框架(对于混合项目)

all*_*ate 6 xcode objective-c cocoapods swift

我有一个 podspec 设置如下:

Pod::Spec.new do |spec|
  spec.name         = "TMGAdvertising"
  spec.default_subspecs = ["Core"]
  *** [extra stuff removed] ***

  spec.subspec 'Core' do |tmgadvertising|
    *** [extra stuff removed] ***
  end

  spec.subspec 'Inneractive' do |inneractive|
    inneractive.dependency "TMGAdvertising/Core"
    inneractive.private_header_files  = "TMGAdvertising/AdNetworkSupport/Inneractive/SDK/*.h", "TMGAdvertising/AdNetworkSupport/Inneractive/Adapters/*.h"
    inneractive.public_header_files  = "TMGAdvertising/AdNetworkSupport/Inneractive/InneractiveWrapper.h"
    inneractive.source_files  = ["TMGAdvertising/AdNetworkSupport/Inneractive/Adapters/*.{h,m,swift}", "TMGAdvertising/AdNetworkSupport/Inneractive/SDK/*.{h,m,swift}", "TMGAdvertising/AdNetworkSupport/Inneractive/InneractiveWrapper.{h,m,swift}"]
    inneractive.vendored_frameworks = "TMGAdvertising/AdNetworkSupport/Inneractive/SDK/*.framework"
    inneractive.pod_target_xcconfig = { 'OTHER_LDFLAGS' => ['-ObjC'] }
  end
end
Run Code Online (Sandbox Code Playgroud)

我在 Obj-C(位于 TMGAdvertising 中)中为 Inneractive 框架编写包装类没有问题。这是我的 Obj-C 包装器示例之一:

#import "InneractiveWrapper.h"
@import IASDKCore;

@implementation InneractiveWrapper

+ (void)initializeSDK:(NSString *)appId {
    [[IASDKCore sharedInstance] initWithAppID:appId];    
}

@end
Run Code Online (Sandbox Code Playgroud)

问题是我不想用 Objective-C 编写我的包装器——我更喜欢用 Swift 编写它们。

通常,我可以使用桥接头来完成此操作(这是直接集成到应用程序之前的设置方式),但由于这是一个子规范,我的理解是这是不可能的。

我的问题是:有什么方法可以直接将这个供应商提供的 Inneractive 框架导入位于 TMGAdvertising pod 中的 Swift 文件中?

Cas*_*sey -1

据我所知,您应该能够在桥接标头中导入该文件。

@import IASDKCore;
Run Code Online (Sandbox Code Playgroud)