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

Everything worked until I updated MacOS to v 10.15.7 I cannot assure this is the real problem, though.

The same code works perfectly emulated on Android, but I get the following errors when I run it on 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)

No problem with the flutter doctor:

╰─❯ 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!

I've tried solving with solutions proposed in other threads but nothing worked.

My pubspec.yaml looks like this:

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

In my info.plist:

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

As soon as I hard-code the CFBundleVersion happens the same thing with CFBundleShortVersionString:

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

I guess is some problem getting these variables from the env.

Thanks in advance, Daniel


Solution 1:

The application's Info.plist does not contain CFBundleVersion

The above error comes when we haven't declared Version filed, inside Xcode

enter image description here

Note: Version can be anything but to make sense we always start with 1.0.0 then increment the number as your release.