2

に追加pod 'CrittercismSDK'してPodfile実行しましたpod install、エラーなしで終了しました。すべて問題ありません。

を使用するとエラーimport Crittercismが発生しNo such moduleます。ディレクトリを調べたところ、Pods/ソースコードがあります。ただし、Podsプロジェクトにはターゲットという名前がありませんPods-MyProject-Crittercism (ただし、依存関係ごとにターゲットがあります)。

インポートが見つからないため、ビルドが失敗し続けます。私は何を間違っていますか?

PS: でuse_frameworks!ディレクティブを使用してPodfileいますが、正常に動作する別のobj-cライブラリがあるため、これが動作しない理由がわかりません。

4

2 に答える 2

1

これは一般的な答えではありませんが、次のことがわかりました。

  1. 使用していません#use_frameworks
  2. Bridging-Header.hを使用して#import "Crittercism.h"
  3. クラスにインポートCrittercismSDKするのではSwiftなく、実行するだけでCrittercism.enableWithAppID("appId")うまくいきます。
于 2015-07-18T01:29:23.887 に答える
1

See if below steps helps in your case. What version of pod/Xcode in use? It will be great if you can share your pod file, thanks.

  1. Install dependencies using Cocoapods and the use_frameworks! flag.
  2. As you need to use a Objective-C dependency, create a Bridging header. You can create one easily by importing an Objective-C class to your Swift project, than remove it (the wizard should ask you if need a bridging header). Otherwise, create a new header file. Then, navigate to your target configuration and enter the name of your file in Swift Compiler - Code Generation > Objective-C Bridging header.
  3. 引き続きターゲット構成で、[検索パス] > [ユーザー ヘッダー検索パス: ポッド] に値として新しいエントリを追加し、再帰としてフラグを立てます。
  4. Objective-C ライブラリに関連するインポート命令をコードから削除します。
  5. プロジェクトをビルドします。あなたは成功するはずです。
于 2015-07-20T22:16:20.750 に答える