4

次の 2 つのファイルを含む Objective-C ポッドを作成しました。

Source/SomeViewController.h
Source/SomeViewController.m

また、ポッドにブリッジング ヘッダーを作成しました。

Source/Bridging-Header.h

内容:

#import "SomeViewController.h"

私のポッドスペックは次のようになります。

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 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と、ポッドは正しくインストールされていますが、ポッドからのブリッジ ヘッダーが正しくインストールされていません。私がやろうとした私のSwiftプロジェクト:

let vc: SomeViewController

Pod からのブリッジング ヘッダーがインストールされていないため、これによりエラーが発生します。

podspec正しくインストールされているポッドのブリッジ ヘッダーを取得するには、どのように構成する必要がありますか?

4

1 に答える 1