skip to Main Content

I tried to run my flutter app on iOS but it didn’t work.
Android works fine.

I already uninstalled CocoaPods and reinstalled it.
Also I done flutter clean, I cleaned the Xcode builds and the android studio caches and restarted the IDE.

Here is the terminal output:

Launching lib/main.dart on iPhone 13 in debug mode...
Running pod install...                                             11,0s
Running Xcode build...                                                  
 └─Compiling, linking and signing...                        11,8s
Xcode build done.                                           256,6s
Unable to install .../build/ios/iphonesimulator/Runner.app on [EmulatorId]. 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 a valid CFBundleVersion.
Ensure your bundle contains a valid CFBundleVersion.
  Command: /usr/bin/arch -arm64e xcrun simctl install [EmulatorId]
.../build/ios/iphonesimulator/Runner.app
Error launching application on iPhone 13.

Here is my flutter doctor -v:

[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-arm, locale
    de-DE)
    • Flutter version 2.8.1 at .../dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (vor 7 Wochen), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at .../Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: .../Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/211.7628.21.2111.8092744
      /Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

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

[✓] Android Studio (version 2021.1)
    • Android Studio at .../Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/211.7628.21.2111.8092744
      /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.11+0-b60-7772763)

[✓] VS Code (version 1.62.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • iPhone 13 (mobile) • 0F835380-920C-4850-8AE2-65842F4ECCF1 • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • Chrome (web)       • chrome                               • web-javascript
      • Google Chrome 97.0.4692.99

• No issues found!

Here is my info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>$(DEVELOPMENT_LANGUAGE)</string>
    <key>CFBundleDisplayName</key>
    <string>[AppName]</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleGetInfoString</key>
    <string></string>
    <key>CFBundleIconName</key>
    <string>AppIcon</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>[AppName]</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$(FLUTTER_BUILD_NAME)</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>$(FLUTTER_BUILD_NUMBER)</string>
    <key>ITSAppUsesNonExemptEncryption</key>
    <false/>
    <key>LSApplicationCategoryType</key>
    <string></string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>MinimumOSVersion</key>
    <string>12.0</string>
    <key>NSCameraUsageDescription</key>
    <string>camera</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>This app needs photo library access to choose a photo for the goal page</string>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UIStatusBarHidden</key>
    <false/>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
    <key>io.flutter.embedded_views_preview</key>
    <true/>
</dict>
</plist>

Please let me know if anything is missing. I will add it.
Thank you in advance!

2

Answers


  1. This problem can appear when upgrading flutter.

    For each XCBuildConfiguration in the project.pbxproj : Release and debug, the baseConfigurationReference was updated to the reference of file "Pods-Runner.release.xcconfig" (or Pods-Runner.debug.xcconfig for the debug build config). When we use flutter this reference must be Release.xcconfig (in the folder ios/Flutter) who contains all the flutter variables that will be used inside the info.plist file (and also all the variables of Runner.<build>.xcconfig).

    So, for getting the right references, go to the PBXFileReference section and search a ref with name "Release.xcconfig" like that for me (for the release.xcconfig):

    7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
    

    There are reference for Release, change the of your baseConfigurationReference by the reference you found

    Do the same thing with the Debug.xcconfig.

    The profile’s baseConfigurationReference must be udpated by the Release.xcconfig file reference (there aren’t Profile.xcconfig…)

    Login or Signup to reply.
  2. go to ios/Flutter/Debug.xcconfig file and add this line in the end of the file:

    #include "Generated.xcconfig"
    

    so the file will look like this:

    #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
    #include "Generated.xcconfig"
    
    

    This is happing because the generated configuration is not included in the debug build. Adding the line above ensure to add the generated configuration from your pubspec.yaml file to info.plist

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search