首页 > 解决方案 > 无法在 Iphone 上模拟应用程序

问题描述

无法为模拟器构建应用程序。在 iPhone 11 Pro Max 上启动应用程序时出错。

我已经尝试更新 pod,使用 flutter clean 和其他一些东西,但对我没有用。拜托,我需要帮助!!!

在调试模式下在 iPhone 11 Pro Max 上启动 lib/main.dart...

Running pod install...

Running Xcode build...  

Xcode build done.

Failed to build iOS app
Error output from Xcode build:

↳
    ** BUILD FAILED **
Xcode's output:
↳
    Undefined symbols for architecture x86_64:
      "_gpr_time_cmp", referenced from:
          grpc::Timespec2Timepoint(gpr_timespec) in time_cc.o
      "grpc_resource_user_unref(grpc_resource_user*)", referenced from:
          grpc::ThreadManager::~ThreadManager() in thread_manager.o
      "_grpc_census_call_get_context", referenced from:
          grpc::ServerContext::census_context() const in server_context.o
      "_gpr_now", referenced from:
          grpc_impl::Server::SyncRequestThreadManager::PollForWork(void**, bool*) in server_cc.o
      "_grpc_server_cancel_all_calls", referenced from:
          grpc_impl::Server::ShutdownInternal(gpr_timespec) in server_cc.o
      "_grpc_server_start", referenced from:
          grpc_impl::Server::Start(grpc_impl::ServerCompletionQueue**, unsigned long) in server_cc.o
      "_grpc_server_register_method", referenced from:
          grpc_impl::Server::RegisterService(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >
          const*, grpc::Service*) in server_cc.o
      "grpc_inproc_channel_create(grpc_server*, grpc_channel_args*, void*)", referenced from:
          grpc_impl::Server::InProcessChannel(grpc_impl::ChannelArguments const&) in server_cc.o
          grpc_impl::Server::experimental_type::InProcessChannelWithInterceptors(grpc_impl::ChannelArguments const&,
          std::__1::vector<std::__1::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface,
          std::__1::default_delete<grpc::experimental::ClientInterceptorFactoryInterface> >,
          std::__1::allocator<std::__1::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface,
          std::__1::default_delete<grpc::experimental::ClientInterceptorFactoryInterface> > > >) in server_cc.o
      "_grpc_server_destroy", referenced from:
          grpc_impl::Server::~Server() in server_cc.o
      "_gpr_time_add", referenced from:
          grpc_impl::Server::SyncRequestThreadManager::PollForWork(void**, bool*) in server_cc.o
      "_grpc_server_create", referenced from:
          grpc_impl::Server::Server(int, grpc_impl::ChannelArguments*,
          std::__1::shared_ptr<std::__1::vector<std::__1::unique_ptr<grpc_impl::ServerCompletionQueue,
          std::__1::default_delete<grpc_impl::ServerCompletionQueue> >,
          std::__1::allocator<std::__1::unique_ptr<grpc_impl::ServerCompletionQueue,
          std::__1::default_delete<grpc_impl::ServerCompletionQueue> > > > >, int, int, int, grpc_resource_quota*,
          std::__1::vector<std::__1::unique_ptr<grpc::experimental::ServerInterceptorFactoryInterface,
          std::__1::default_delete<grpc::experimental::ServerInterceptorFactoryInterface> >,
          std::__1::allocator<std::__1::unique_ptr<grpc::experimental::ServerInterceptorFactoryInterface,
          std::__1::default_delete<grpc::experimental::ServerInterceptorFactoryInterface> > > >) in server_cc.o
      "_gpr_once_init", referenced from:
          grpc_impl::ServerBuilder::ServerBuilder() in server_builder.o
          grpc_impl::ServerBuilder::InternalAddPluginFactory(std::__1::unique_ptr<grpc::ServerBuilderPlugin,
          std::__1::default_delete<grpc::ServerBuilderPlugin> > (*)()) in server_builder.o
          grpc_impl::Server::Server(int, grpc_impl::ChannelArguments*,
          std::__1::shared_ptr<std::__1::vector<std::__1::unique_ptr<grpc_impl::ServerCompletionQueue,
          std::__1::default_delete<grpc_impl::ServerCompletionQueue> >,
          std::__1::allocator<std::__1::unique_ptr<grpc_impl::ServerCompletionQueue,
          std::__1::default_delete<grpc_impl::ServerCompletionQueue> > > > >, int, int, int, grpc_resource_quota*,
          std::__1::vector<std::__1::unique_ptr<grpc::experimental::ServerInterceptorFactoryInterface,
          std::__1::default_delete<grpc::experimental::ServerInterceptorFactoryInterface> >,
          std::__1::allocator<std::__1::unique_ptr<grpc::experimental::ServerInterceptorFactoryInterface,
          std::__1::default_delete<grpc::experimental::ServerInterceptorFactoryInterface> > > >) in server_cc.o
      "_grpc_alts_server_credentials_create", referenced from:
          grpc_impl::experimental::AltsServerCredentials(grpc_impl::experimental::AltsServerCredentialsOptions const&) in
          secure_server_credentials.o
      "_grpc_server_credentials_set_auth_metadata_processor", referenced from:
          grpc_impl::SecureServerCredentials::SetAuthMetadataProcessor(std::__1::shared_ptr<grpc_impl::AuthMetadataProcessor>
          const&) in secure_server_credentials.o
      "grpc_resource_user_allocate_threads(grpc_resource_user*, int)", referenced from:
          grpc::ThreadManager::MainWorkLoop() in thread_manager.o
          grpc::ThreadManager::Initialize() in thread_manager.o
      "_grpc_google_iam_credentials_create", referenced from:
          grpc_impl::GoogleIAMCredentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >
          const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in
          secure_credentials.o
      "_grpc_access_token_credentials_create", referenced from:
          grpc_impl::AccessTokenCredentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >
          const&) in secure_credentials.o
      "_grpc_google_refresh_token_credentials_create", referenced from:
          grpc_impl::GoogleRefreshTokenCredentials(std::__1::basic_string<char, std::__1::char_traits<char>,
          std::__1::allocator<char> > const&) in secure_credentials.o
      "_gpr_time_from_seconds", referenced from:
          grpc_impl::ServiceAccountJWTAccessCredentials(std::__1::basic_string<char, std::__1::char_traits<char>,
          std::__1::allocator<char> > const&, long) in secure_credentials.o
      "_grpc_local_credentials_create", referenced from:
          grpc_impl::experimental::LocalCredentials(grpc_local_connect_type) in secure_credentials.o
      "_grpc_alts_credentials_client_options_create", referenced from:
          grpc_impl::experimental::AltsCredentials(grpc_impl::experimental::AltsCredentialsOptions const&) in secure_credentials.o
      "_grpc_ssl_credentials_create", referenced from:
          grpc_impl::SslCredentials(grpc_impl::SslCredentialsOptions const&) in secure_credentials.o
      "_grpc_call_set_credentials", referenced from:
          grpc_impl::SecureCallCredentials::ApplyToCall(grpc_call*) in secure_credentials.o
      "_gpr_strdup", referenced from:
          grpc::MetadataCredentialsPluginWrapper::InvokePlugin(grpc_auth_metadata_context, void (*)(void*, grpc_metadata const*,
          unsigned long, grpc_status_code, char const*), void*, grpc_metadata*, unsigned long*, grpc_status_code*, char const**) in
          secure_credentials.o
      "_grpc_secure_channel_create", referenced from:
          grpc_impl::SecureChannelCredentials::CreateChannelWithInterceptors(std::__1::basic_string<char,
          std::__1::char_traits<char>, std::__1::allocator<char> > const&, grpc_impl::ChannelArguments const&,
          std::__1::vector<std::__1::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface,
          std::__1::default_delete<grpc::experimental::ClientInterceptorFactoryInterface> >,
          std::__1::allocator<std::__1::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface,
          std::__1::default_delete<grpc::experimental::ClientInterceptorFactoryInterface> > > >) in secure_credentials.o
      "_grpc_auth_context_peer_is_authenticated", referenced from:
          grpc::SecureAuthContext::IsPeerAuthenticated() const in secure_auth_context.o
      "_grpc_auth_context_set_peer_identity_property_name", referenced from:
          grpc::SecureAuthContext::SetPeerIdentityPropertyName(std::__1::basic_string<char, 

..........

问题并没有在这里结束,但是对于stackoverflow来说太长了

    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    note: Using new build system
    note: Planning build
    note: Constructing build description
    warning: Mapping architecture armv7 to i386. Ensure that this target's Architectures and Valid Architectures build settings are
    configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
    warning: Mapping architecture arm64 to x86_64. Ensure that this target's Architectures and Valid Architectures build settings
    are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
    warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID.
    To resolve this, select a development team in the Runner editor. (in target 'Runner' from project 'Runner')

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

下面我将发布颤振医生的详细信息

[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.5 18F132, locale pt-BR)
    • Flutter version 1.12.13+hotfix.5 at /Users/gabrieloureiro/Documents/flutter
    • Framework revision 27321ebbad (13 days ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/gabrieloureiro/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3, Build version 11C29
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 42.0.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.41.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.7.1

[✓] Connected device (1 available)
    • iPhone 11 Pro Max • E831AA78-1E33-402C-92D5-A227F16E4F49 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)

• No issues found!

标签: iosxcodedebuggingflutterdart

解决方案


此错误可能与Undefined symbols for architecture i386
这对我有用 - 对于报告警告的目标,将“有效架构”设置更改为:

$(VALID_ARCHS)
x86_64

单击获取依赖项。
PS如果这没有帮助,请转到构建设置并搜索“No Common Blocks”并将其设置为“No”。构建并运行。


推荐阅读