繁体   English   中英

Flutter:应用程序的Info.plist不包含CFBundleVersion

[英]Flutter: The application's Info.plist does not contain CFBundleVersion

在我将 MacOS 更新到 v 10.15.7 之前一切正常,但我不能保证这是真正的问题。

相同的代码在 Android 上完美模拟,但在 iPhone 上运行时出现以下错误:

[   +2 ms] Unable to install /Users/***/project_dir/build/ios/iphonesimulator/Runner.app on 4E3679AE-08E6-4DBE-A940-20E4D34F2122. This is
sometimes caused
           by a malformed plist file:
           ProcessException: Process exited abnormally:
           An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
           Failed to install the requested application
           The application's Info.plist does not contain CFBundleVersion.
           Ensure your bundle contains a CFBundleVersion.
             Command: /usr/bin/xcrun simctl install 4E3679AE-08E6-4DBE-A940-20E4D34F2122
/Users/***/project_dir/build/ios/iphonesimulator/Runner.app
[   +1 ms] Error launching application on iPhone 11 Pro.
[   +3 ms] "flutter run" took 41.403ms.
[  +10 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:607:7)
           <asynchronous suspension>
           #2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:977:18)
           #3      _rootRunUnary (dart:async/zone.dart:1198:47)
           #4      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #5      _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #6      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #7      Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #8      Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #9      _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
           #10     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
           #11     RunCommand.usageValues (package:flutter_tools/src/commands/run.dart)
           #12     _rootRunUnary (dart:async/zone.dart:1198:47)
           #13     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #14     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #15     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #16     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #17     Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #18     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
           #19     _rootRun (dart:async/zone.dart:1190:13)
           #20     _CustomZone.run (dart:async/zone.dart:1093:19)
           #21     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
           #22     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
           #23     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
           #24     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
           #25     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
           #26     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

flutter医生没问题:

╰─❯ flutter doctor
[✓] Flutter (Channel stable, 1.22.1, on Mac OS X 10.15.7 19H2, locale it-SE)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.49.3)
[✓] Connected device (2 available)

• No issues found!

我尝试使用其他线程中提出的解决方案来解决,但没有任何效果。

我的 pubspec.yaml 看起来像这样:

name: eat_eat_shop
description: Nom Nom.

version: 1.0.0+1

environment:
  sdk: ">=2.8.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.0
  flutter_bloc: ^6.0.5
  equatable: ^1.2.5
  firebase_auth: ^0.18.0+1
  dartz: ^0.9.1
  freezed_annotation: ^0.12.0
  firebase_core: ^0.5.0
  google_sign_in: ^4.5.4
  cloud_firestore: ^0.14.0+2
  firebase_storage: ^4.0.0
  get_it: ^4.0.4
  injectable: ^1.0.4
  flushbar: ^1.10.4
  uuid: ^2.2.2
  auto_route: ^0.6.7
  image: ^2.1.17
  kt_dart: ^0.7.0+1
  json_annotation: ^3.1.0
  rxdart: ^0.24.1
  flutter_cache_manager_firebase: ^1.0.1
  file_picker: ^2.0.3
  flutter_hooks: ^0.14.0
  path_provider: ^1.6.18
  logger: ^0.9.3
  firebase_image: ^0.2.0

dev_dependencies:
  build_runner:
  flutter_test:
    sdk: flutter
  mockito: ^4.1.0
  freezed: ^0.12.1
  lint: ^1.2.0
  injectable_generator: ^1.0.4
  auto_route_generator: ^0.6.8
  json_serializable: ^3.5.0

flutter:
  uses-material-design: true
  assets:
    - images/default_product_image.png

在我的 info.plist 中:

    <key>CFBundleVersion</key>
    <string>$(FLUTTER_BUILD_NUMBER)</string>

一旦我对 CFBundleVersion 进行硬编码,CFBundleShortVersionString 就会发生同样的事情:

    <key>CFBundleShortVersionString</key>
    <string>$(FLUTTER_BUILD_NAME)</string>

我猜是从环境中获取这些变量有些问题。

提前致谢, 丹尼尔

应用程序的 Info.plist 不包含 CFBundleVersion

当我们没有在Xcode 中声明Version文件时,就会出现上述错误

在此处输入图片说明

注意:版本可以是任何东西,但为了有意义,我们总是从1.0.0开始,然后随着您的发布增加数字。

我有我的主要目标的正确版本,但我忘记了我的其他目标,确保它们也有一个版本和内部版本号在此处输入图片说明

我遇到了同样的问题,它是由于格式化 info.plist 文件时出错而发生的,我通过将其返回到默认视图来解决它。

我已经尝试了所有这些解决方案,但不幸的是它们都不适合我。 经过几个小时的努力,幸运的是我找到了下面的解决方案并且它对我有用。

https://github.com/flutter/flutter/issues/99995

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM