简体   繁体   中英

Flutter build fails for iOS Xcode 10

I upgraded Flutter to latest. Following is the doctor output

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.8.2, on Mac OS X 10.14 18A326h, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.1)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
[✓] Android Studio (version 3.1)
[✓] VS Code (version 1.27.1)

When I run the app with target to iOS simulator, I get this

Launching lib/main.dart on iPhone XS Max in debug mode...
Starting Xcode build...
Xcode build done.
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    error: Multiple commands produce '/Users/kalehv/dev/todo/todo-flutter/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework':
    1) Target 'Runner' has copy command from '/Users/kalehv/dev/todo/todo-flutter/ios/Flutter/Flutter.framework' to '/Users/kalehv/dev/todo/todo-flutter/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework'
    2) That command depends on command in Target 'Runner': script phase “[CP] Embed Pods Frameworks”
    warning: The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Runner" target. (in target 'Runner')
    warning: ignoring duplicated output file: '/Users/kalehv/dev/todo/todo-flutter/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework' (in target 'Runner')
    note: Using new build systemnote: Planning buildnote: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone XS Max.

I think this would help at least it worked for me url .

Open your Xcode and there is File upper-left next to Apple icon, then open Workspace Settings and change the build system to Legacy Build System .

I had the same problem, but when I changed to Legacy Build System I got a ton of Apple Mach-O Linker Error 's instead.

I finally narrowed the problem down to a setting in Runner.xcodeproj/project.pbxproj (which can be manipulated from XCode in the Runner -> Build settings tab).

I had somehow set

Build active architecture only
           - Debug                   No
           - Profile                 Yes
           - Release                 Yes

Changing it to

Build active architecture only
           - Debug                   Yes
           - Profile                 Yes
           - Release                 Yes

solved the errors.

I fix this By uncommit platform target in the Podfile inside ios folder, So it will be 9. Then you must change the platform target from Xcode to 9 this very important. after that do this Open your Xcode and there is File upper-left next to Apple icon, then open Workspace Settings and change the build system to Legacy Build System .

then do this post link

Hit the clean button project in Xcode and run it.

I hope this will help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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