将 OpenCV 与 XCode 集成 - 排除的架构

Integrating OpenCV with XCode - Excluded Architecture

尝试在 swift 中使用 OpenCV 库。

图书馆强制我实施以下更改:

否则,如果没有这些更改,我会收到错误消息:

同样在这个应用程序中,我希望用户从 phone 的画廊中挑选一张图片。为了处理它,我正在使用 PHPicker。 但是,设置了排除架构后,我无法从图库中选择任何图像,终端中有很多 errors/warnings。 如果没有排除的架构,应用程序将崩溃并显示第二个屏幕上的错误。 有什么想法或提示吗?

屏幕错误

Ld /Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Products/Debug-iphonesimulator/OpenCVTest.app/OpenCVTest normal (in target 'OpenCVTest' from project 'OpenCVTest')
    cd /Users/Kacper/Downloads/OpenCVTest
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target arm64-apple-ios12.0-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk -L/Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Products/Debug-iphonesimulator -F/Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Products/Debug-iphonesimulator -F/Users/Kacper/Downloads/OpenCVTest -filelist /Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Intermediates.noindex/OpenCVTest.build/Debug-iphonesimulator/OpenCVTest.build/Objects-normal/arm64/OpenCVTest.LinkFileList -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Intermediates.noindex/OpenCVTest.build/Debug-iphonesimulator/OpenCVTest.build/Objects-normal/arm64/OpenCVTest_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -stdlib\=libc++ -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Intermediates.noindex/OpenCVTest.build/Debug-iphonesimulator/OpenCVTest.build/Objects-normal/arm64/OpenCVTest.swiftmodule -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Intermediates.noindex/OpenCVTest.build/Debug-iphonesimulator/OpenCVTest.build/OpenCVTest.app-Simulated.xcent -framework opencv2 -framework CoreFoundation -framework Accelerate -framework CoreGraphics -framework AssetsLibrary -framework CoreMedia -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Intermediates.noindex/OpenCVTest.build/Debug-iphonesimulator/OpenCVTest.build/Objects-normal/arm64/OpenCVTest_dependency_info.dat -o /Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Products/Debug-iphonesimulator/OpenCVTest.app/OpenCVTest

ld: in /Users/Kacper/Downloads/OpenCVTest/opencv2.framework/opencv2(ios_conversions.o), building for iOS Simulator, but linking in object file built for iOS, for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

文本格式错误不是我的错!

so, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64 I guess that means you need the library built for the simulator, not for the actual target device.

当你尝试编译它时,它会工作,使用真实 iPhone/iPad