skip to Main Content

I just started getting this issue after upgrading to Xcode 13. I upgraded Flutter to 2.5.1 a few days before.

This is what I am seeing:

Failed to build iOS app
Error output from Xcode build:
↳
    --- xcodebuild: WARNING: Using the first of multiple matching destinations:
    { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
    { platform:iOS Simulator, id:AA0EE6D2-4E24-48C6-B9D6-4F2598B68E4E, OS:15.0, name:iPad (9th generation) }
    { platform:iOS Simulator, id:765C02E6-837E-4443-9073-722162C490DC, OS:15.0, name:iPad Air (4th generation) }
    { platform:iOS Simulator, id:30429B61-93BC-4497-B556-3639373A10D0, OS:15.0, name:iPad Pro (9.7-inch) }
    { platform:iOS Simulator, id:57217E13-F700-4673-9ABF-1866BAE1E435, OS:15.0, name:iPad Pro (11-inch) (3rd generation) }
    { platform:iOS Simulator, id:A85DD0A6-EA0F-480C-9A6F-07966F4FE66B, OS:15.0, name:iPad Pro (12.9-inch) (5th generation) }
    { platform:iOS Simulator, id:1D568B75-852B-42BE-8178-C39E6C515C41, OS:15.0, name:iPad mini (6th generation) }
    { platform:iOS Simulator, id:347466A9-6BA4-4674-94B6-BCB3ACB11F00, OS:15.0, name:iPhone 8 }
    { platform:iOS Simulator, id:F74B444A-2838-4920-91DB-83893719250E, OS:15.0, name:iPhone 8 Plus }
    { platform:iOS Simulator, id:2D4AF847-04A7-463C-A46C-D5D1E200CFDC, OS:15.0, name:iPhone 11 }
    { platform:iOS Simulator, id:BCD3D3BD-6485-4575-AA35-BF9ADEEBB4BD, OS:15.0, name:iPhone 11 Pro }
    { platform:iOS Simulator, id:06DE013F-BF48-4857-B952-BFC2AA1BD304, OS:15.0, name:iPhone 11 Pro Max }
    { platform:iOS Simulator, id:8A06D628-6132-4558-BB65-5598FFAC98DC, OS:15.0, name:iPhone 12 }
    { platform:iOS Simulator, id:885B1C8A-0497-4D95-8A87-447E40AB9238, OS:15.0, name:iPhone 12 Pro }
    { platform:iOS Simulator, id:FF519331-8490-4219-92D0-ED9A08F11976, OS:15.0, name:iPhone 12 Pro Max }
    { platform:iOS Simulator, id:51671583-ED36-4330-839B-401BA09B3996, OS:15.0, name:iPhone 12 mini }
    { platform:iOS Simulator, id:950FC388-6567-40BD-AD31-6CC5A334AC97, OS:15.0, name:iPhone 13 }
    { platform:iOS Simulator, id:562728AB-E0CA-4675-BF75-787299ECE105, OS:15.0, name:iPhone 13 Pro }
    { platform:iOS Simulator, id:CBB3D2FF-97DF-4328-8AD0-7350F83989D1, OS:15.0, name:iPhone 13 Pro Max }
    { platform:iOS Simulator, id:D99FD6E3-C6DC-4F16-8092-83EA0216367F, OS:15.0, name:iPhone 13 mini }
    { platform:iOS Simulator, id:2A06C9C4-9D8C-4C9B-9620-12265131A747, OS:15.0, name:iPhone SE (2nd generation) }
    { platform:iOS Simulator, id:EA2B1A03-78F8-42B2-9818-41FE3F1E833A, OS:15.0, name:iPod touch (7th generation) }
    { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
    ** BUILD FAILED **
Xcode's output:
↳
    /Users/abc/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.2/ios/Classes/messages.m:4:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in parallel
Could not build the application for the simulator.

I have tried re-installing Flutter, deleting and re-cloning my project, removing the pods, flutter clean + pod install, flutter cache repair, and removing Flutter from the project and re-adding.

Each of these results in some variation of the error above.

I also had to make a change in my Podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
   target.build_configurations.each do |config|
    config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
   end
  end
 end

If I revert this back then I get a different set of errors where some pods are complaining about being set to 8.0 and need to be 9.0 to 14.9.9.

I tried changing the individual pods in the Runner project but that doesn’t work. The above clear out that error but now I am faced with the other.

To note, Android works fine. It’s just iOS.

Any other suggestions for this one?

2

Answers


  1. This is what worked for me:

    In Podfile:
    Replace

    post_install do |installer|
      installer.pods_project.targets.each do |target|
       target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
       end
      end
     end
    

    By

    post_install do |installer| 
      installer.pods_project.targets.each do |target| 
        flutter_additional_ios_build_settings(target) 
      end 
    end
    

    Then open iOS file in Xcode, and in Pods, for each Target, in Build Settings, set deployment target to 11 (maybe 9 is enough)

    Is this what you tried already ?

    Login or Signup to reply.
  2. Had similar issue with XCode 13 and Flutter 2.5.3: building via xcodebuild gave error (building from UI works ok) for random modules. After I tried to remove ‘problematic’ library – error was against next random library until I got stuck to Flutter.h.

    My problem was that during solving issues I changed the deployment target to 13 in XCode but made a mess: I updated it in Podfile, Project->Runner->Info, Project->Runner->Build settings, but forgot to do it for Targets->Runner->Build Settings.

    Once I’ve updated Targets->Runner->Build Settings as well it started to compile successfully.

    Eventually I’ve rolledback to Target 11.0 in all places and it still compiles.

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