26

リンカの問題について不平を言う過去のxCode 4のある時点から始めます:

ld: 警告: MacOSX 用にビルドしていますが、iOS 用にビルドされた dylib に対してリンクしています: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks//CoreGraphics.framework/CoreGraphics

すべてをチェックしましたが、構成に疑わしいものは何もなく、コンパイルして実行します。CoreGraphics.framework の前の二重スラッシュだけが表示されますが、その理由はわかりません。「ビルドフェーズ」でライブラリを削除して再度追加しようとしましたが、役に立ちませんでした。

4

4 に答える 4

6

Xcode が使用しているコマンド ラインのビルド ログを確認することで、Xcode の問題を簡単にデバッグできる場合があります。

コマンド ラインからビルドしている場合、 -miphoneos-version-min= を指定しないと、そのメッセージを取得できます。

This compiles:
(where conftest.c just contains int main() {})
/Applications/Xcode5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 --sysroot /Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk --sysroot /Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -miphoneos-version-min=6.0 conftest.c

And this gives the error:
/Applications/Xcode5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 --sysroot /Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk --sysroot /Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk  conftest.c
ld: building for MacOSX, but linking against dylib built for iOS Simulator file '/Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/usr/lib/libSystem.dylib' for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
于 2013-07-29T16:00:30.193 に答える
0

Carthage を使用して Mac アプリをコンパイルしている場合は、プロジェクトを検索するFramework Search Paths$(PROJECT_DIR)/Carthage/Build/iOS.

それを削除すると、問題が解決しました。

于 2015-12-24T19:03:09.067 に答える
-3

この問題は、Xcode に間違ったフレームワーク バージョンが含まれていることが原因です。このプロジェクトは Mac OS X 用にビルドされていますが、iOS バージョンのフレームワークを使用しています。

于 2013-07-16T03:56:15.407 に答える