【问题标题】:running in android devices and simulator but trouble with IPhone simulator在 android 设备和模拟器中运行,但 iPhone 模拟器出现问题
【发布时间】:2021-10-20 10:33:46
【问题描述】:

我正在尝试在 iPhone 12 pro max 模拟器中运行我的颤振应用程序。它在 android 设备和模拟器中成功运行,但我在 ios 平台上运行时遇到问题。颤动中的 Connectivity 5.0.0 似乎有问题,但我在 PodFile 中手动添加如下:

# Uncomment the next line to define a global platform for your project
platform :ios, '12.1'

target 'glamme' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for glamme
  pod "Firebase"
  pod "Connectivity"    

  target 'glammeTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'glammeUITests' do
    # Pods for testing
  end

end

target 'Runner' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Runner
  pod "Firebase"
  pod "Connectivity"

end

这是我尝试在 iPhone 12 pro max 模拟器中运行时的输出

Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running Xcode build...                                                  
 └─Compiling, linking and signing...                      1,208ms
Xcode build done.                                           13.4s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳    
../ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'connectivity' not found
        @import connectivity;
         ~~~~~~~^~~~~~~~~~~~
        1 error generated.
        note: Using new build system
        note: Building targets in parallel
        note: Planning build
        note: Constructing build description
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target
        'FirebaseInstallations' from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Connectivity'
        from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'nanopb' from
        project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target
        'GoogleDataTransport' from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target
        'GoogleUtilities' from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target
        'FirebaseCoreDiagnostics' from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'FirebaseCore'
        from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target
        'GoogleAppMeasurement' from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target
        'FirebaseAnalytics' from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Firebase'
        from project 'Pods')

这是我的颤振医生 -v 输出:

[✓] Flutter (Channel stable, 2.2.3, on macOS 11.2 20D64 darwin-x64, locale en-GB)
    • Flutter version 2.2.3 at /Volumes/Macintosh HD - Data/development/flutter
    • Framework revision f4abaa0735 (4 months ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/applefriend/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      ???? https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      ???? https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] Connected device (2 available)
    • iPhone 12 Pro Max (mobile) • A54713A9-6BB0-42E6-85C6-7F337B206109 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 94.0.4606.81

• No issues found!

【问题讨论】:

    标签: firebase flutter connectivity


    【解决方案1】:

    通常解决方法是:删除 podfile、flutter clean、flutter pub get 和 flutter build ios。确保平台很重要:pod 文件中的 iOS 版本也与 Xcode 中的部署信息匹配。

    【讨论】:

      猜你喜欢
      • 2012-01-26
      • 2011-08-11
      • 2011-05-08
      • 1970-01-01
      • 2020-01-02
      • 1970-01-01
      • 2011-11-20
      • 1970-01-01
      • 2010-09-27
      相关资源
      最近更新 更多