Flutter 应用程序不是由 Flutter build ios 运行,而是由 xcode 运行

Posted

技术标签:

【中文标题】Flutter 应用程序不是由 Flutter build ios 运行,而是由 xcode 运行【英文标题】:flutter app is not running by flutter build ios but runs by xcode 【发布时间】:2021-10-27 07:45:40 【问题描述】:

我写了flutter应用程序,我用xcode打开了ios部分,应用程序正在运行,但是当我用flutter build ios 的vscode运行应用程序时,我得到了这个错误:

Automatically signing iOS for device deployment using specified development team in Xcode project: FHDGDHARTT
Running pod install...                                              4.1s
Running Xcode build...                                          
Xcode build done.                                            4.1s
Failed to build iOS app
Error output from Xcode build:
↳
    2021-08-27 15:20:15.391 XCBBuildService[25359:181696] Failed to remove: /Users/alt/Library/Developer/Xcode/DerivedData/Runner-cws-s-rvwaltuodobbealdvrytptog/Build/Intermediates.noindex/XCBuildData/7c6f3b0142d0b109056c8c9053a39860-manifest.xcbuild: unlink(/Users/alt/Library/Developer/Xcode/DerivedData/Runner-cws-s-rvwaltuodobbealdvrytptog/Build/Intermediates.noindex/XCBuildData/7c6f3b0142d0b109056c8c9053a39860-manifest.xcbuild): No such file or directory (2)
    2021-08-27 15:20:15.617 XCBBuildService[25359:181696] Failed to remove: /Users/alt/Library/Developer/Xcode/DerivedData/Runner-cws-s-rvwaltuodobbealdvrytptog/Build/Intermediates.noindex/XCBuildData/7c6f3b0142d0b109056c8c9053a39860-desc.xcbuild: unlink(/Users/alt/Library/Developer/Xcode/DerivedData/Runner-cws-s-rvwaltuodobbealdvrytptog/Build/Intermediates.noindex/XCBuildData/7c6f3b0142d0b109056c8c9053a39860-desc.xcbuild): No such file or directory (2)
    ** BUILD FAILED **


Xcode's output:
↳
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete
    /Users/alt/Mobile/Projects/shave-machine-app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'FMDB' from project 'Pods')
    error: No profiles for 'com.shavemachine.shaveMachineApp' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.shavemachine.shaveMachineApp'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from project 'Runner')
    /Users/alt/Mobile/Projects/shave-machine-app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'Reachability' from project 'Pods')
    /Users/alt/Mobile/Projects/shave-machine-app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'Flutter' from project 'Pods')
    /Users/alt/Mobile/Projects/shave-machine-app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'TOCropViewController-TOCropViewControllerBundle' from project 'Pods')
    /Users/alt/Mobile/Projects/shave-machine-app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'TOCropViewController' from project 'Pods')
    /Users/alt/Mobile/Projects/shave-machine-app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'Toast' from project 'Pods')

Encountered error while building for device.
alt@alts-MacBook-Pro shave-machine-app % ff clean    
Cleaning Xcode workspace...                                      2,742ms
Deleting build...                                                   50ms
Deleting .dart_tool...                                               2ms
Deleting .packages...                                                0ms
Deleting Generated.xcconfig...                                       0ms
Deleting flutter_export_environment.sh...                            0ms
Deleting Flutter.podspec...                                          0ms
Deleting .flutter-plugins-dependencies...                            0ms
Deleting .flutter-plugins...                                         0ms
alt@alts-MacBook-Pro shave-machine-app % ff pub get
Running "flutter pub get" in shave-machine-app...                 1,147ms
alt@alts-MacBook-Pro shave-machine-app % ff build ios
Building com.shavemachine.shaveMachineApp for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: FHDGDHARTT
Running pod install...                                              5.5s
Running Xcode build...                                          
Xcode build done.                                            4.4s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete
    /Users/alt/Mobile/Projects/shave-machine-app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'FMDB' from project 'Pods')
    /Users/alt/Mobile/Projects/shave-machine-app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'TOCropViewController' from project 'Pods')
    error: No profiles for 'com.shavemachine.shaveMachineApp' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.shavemachine.shaveMachineApp'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from project 'Runner')
    /Users/alt/Mobile/Projects/shave-machine-app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'Reachability' from project 'Pods')
    /Users/alt/Mobile/Projects/shave-machine-app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'Flutter' from project 'Pods')
    /Users/alt/Mobile/Projects/shave-machine-app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'TOCropViewController-TOCropViewControllerBundle' from project 'Pods')
    /Users/alt/Mobile/Projects/shave-machine-app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'Toast' from project 'Pods')

Encountered error while building for device.

.这是医生:

✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.2 20G95 darwin-x64, locale en-US)
    • Flutter version 2.2.3 at /Users/alt/fvm/versions/stable
    • Framework revision f4abaa0735 (8 weeks 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 31.0.0)
    • Android SDK at /Users/alt/Mobile/Sdk/Andriod/
    • Platform android-31, build-tools 31.0.0
    • ANDROID_HOME = /Users/alt/Mobile/Sdk/Andriod
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 1.8.0_301-b09)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.11.0.rc.1

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

[!] Android Studio (version 2020.3)
    • 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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

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

[✓] Connected device (2 available)
    • iPod touch (7th generation) (mobile) • 9318977C-48B1-4E5E-A483-460F582C9794 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • Chrome (web)                         • chrome                               • web-javascript • Google Chrome 92.0.4515.159

! Doctor found issues in 1 category.

【问题讨论】:

【参考方案1】:

第一步:

第二步:

颤抖干净

那么,

吊舱安装

之后

颤振构建 ios

希望这能解决您的问题,Happy fluttering :)

【讨论】:

当我运行 pod install 我得到了这个pastebin.ubuntu.com/p/5bNFgKkKQm 当我运行 flutter run ios 时,在运行命令 pastebin.ubuntu.com/p/fn9qTtR3rC 后出现此错误。我正在尝试在模拟器上以调试模式运行应用程序 好吧,Tyr 这个命令 => flutter build ios --release --no-tree-shake-icons 如果这对你也不起作用,那么你可以从 XCode 生成你的构建。如果你不知道如何生成,我会告诉你之后的步骤,但首先,运行上面的并得到它的结果。

以上是关于Flutter 应用程序不是由 Flutter build ios 运行,而是由 xcode 运行的主要内容,如果未能解决你的问题,请参考以下文章

为什么原生应用开发者需要关注Flutter?

Flutter 的优缺点及前景

开发Flutter应用前需要先掌握什么?

Flutter渲染之WidgetElementRenderObject

在 Flutter 导入错误中启用 Web

使用Flutter + V8/JsCore开发小程序引擎(一)