Xcode 找不到库/模块。模拟器不会再次运行应用程序

Posted

技术标签:

【中文标题】Xcode 找不到库/模块。模拟器不会再次运行应用程序【英文标题】:Xcode not finding libraries/modules. Simulator won't run the app again 【发布时间】:2020-06-07 03:34:37 【问题描述】:

并提前感谢您。

在处理我的代码时,由于某种奇怪的原因,它刚刚停止工作。我正在研究它,应用程序随机崩溃。然后我无法让它再次启动并运行。我已经尝试了几件事,包括开始一个新的文档和粘贴代码。以及尝试以前的工作版本。

我确实尝试了 Github 的其他项目,并且效果很好。所以我假设这与我的 android studio 安装或其他类型无关。

不幸的是,鉴于错误的随机性,我不确定可以采取哪些步骤来重现它。

这是颤动的错误


Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running Xcode build...
Xcode build done.                                            3.9s
Failed to build ios app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    /Users/armpac/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/vibration-1.2.4/ios/Classes/VibrationPlugin.m:2:9: fatal error: 'vibration/vibration-Swift.h' file not found
    #import <vibration/vibration-Swift.h>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    /Users/armpac/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/contacts_service-0.3.10/ios/Classes/ContactsServicePlugin.m:2:9: fatal error: 'contacts_service/contacts_service-Swift.h' file not found
    #import <contacts_service/contacts_service-Swift.h>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Planning build
    note: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.

另一方面,Xcode 给了我这个:

Ld /Users/armpac/AndroidStudioProjects/Mutuality2/build/ios/Debug-iphonesimulator/Runner.app/Runner normal x86_64 (in target 'Runner' from project 'Runner')
    cd /Users/armpac/AndroidStudioProjects/Mutuality2/ios
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target x86_64-apple-ios8.0-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk -L/Users/armpac/AndroidStudioProjects/Mutuality2/build/ios/Debug-iphonesimulator -L/Users/armpac/AndroidStudioProjects/Mutuality2/build/ios/Debug-iphonesimulator/contacts_service -L/Users/armpac/AndroidStudioProjects/Mutuality2/build/ios/Debug-iphonesimulator/flutter_keyboard_visibility -L/Users/armpac/AndroidStudioProjects/Mutuality2/build/ios/Debug-iphonesimulator/path_provider -L/Users/armpac/AndroidStudioProjects/Mutuality2/build/ios/Debug-iphonesimulator/vibration -L/Users/armpac/AndroidStudioProjects/Mutuality2/build/ios/Debug-iphonesimulator/contacts_service -L/Users/armpac/AndroidStudioProjects/Mutuality2/build/ios/Debug-iphonesimulator/flutter_keyboard_visibility -L/Users/armpac/AndroidStudioProjects/Mutuality2/build/ios/Debug-iphonesimulator/path_provider -L/Users/armpac/AndroidStudioProjects/Mutuality2/build/ios/Debug-iphonesimulator/vibration -L/Users/armpac/AndroidStudioProjects/Mutuality2/ios/Flutter -F/Users/armpac/AndroidStudioProjects/Mutuality2/build/ios/Debug-iphonesimulator -F/Users/armpac/AndroidStudioProjects/Mutuality2/ios/Pods/../Flutter -F/Users/armpac/AndroidStudioProjects/Mutuality2/ios/Pods/../Flutter -F/Users/armpac/AndroidStudioProjects/Mutuality2/ios/Flutter -filelist /Users/armpac/AndroidStudioProjects/Mutuality2/build/ios/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/x86_64/Runner.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/armpac/AndroidStudioProjects/Mutuality2/build/ios/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/x86_64/Runner_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -ObjC -lcontacts_service -lflutter_keyboard_visibility -lpath_provider -lvibration -framework Flutter -ObjC -lcontacts_service -lflutter_keyboard_visibility -lpath_provider -lvibration -framework Flutter -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/armpac/AndroidStudioProjects/Mutuality2/build/ios/Runner.build/Debug-iphonesimulator/Runner.build/Runner.app-Simulated.xcent -framework Flutter -framework App -lPods-Runner -Xlinker -dependency_info -Xlinker /Users/armpac/AndroidStudioProjects/Mutuality2/build/ios/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/x86_64/Runner_dependency_info.dat -o /Users/armpac/AndroidStudioProjects/Mutuality2/build/ios/Debug-iphonesimulator/Runner.app/Runner

ld: library not found for -lcontacts_service
clang: error: linker command failed with exit code 1 (use -v to see invocation)



【问题讨论】:

您是否尝试过添加到 ios/Podfile 行 'use_frameworks!'?喜欢这里***.com/questions/41210249/… 我添加了行,但绝对没有变化。我真的很想知道这是如何从使用 Columns 和 Rows 到完全丢失路径或文档的。 【参考方案1】:

因此,归根结底,我只需要移除包裹即可。确保从 PubSpec.Yml 中删除它,我能找到与它们相关的任何文件夹。清理构建,瞧。

很高兴回到它。

【讨论】:

以上是关于Xcode 找不到库/模块。模拟器不会再次运行应用程序的主要内容,如果未能解决你的问题,请参考以下文章

在 Xcode 中找不到 Flutter 模块

Xcode 编译我的应用程序,但无法在模拟器中运行它

运行xcode应用程序时找不到设备消息[重复]

在较旧的 iOS 模拟器上运行时 Xcode 10 测试失败 - “无法加载测试包......找不到合适的图像”

IOS Simulator 找不到 sdk 和模拟的应用程序退出错误

找不到 -lAFNetworking 的 xcode 库