How to fix Flutter Failed to build iOS app? - ios

I updated my Xcode to Version 13.4 and android studio to Chipmunk and after this, I am getting below error while trying to build for ios. This issue is only occurring for ios builds.
Below is the log I am getting.
Xcode build done. 19.5s
Failed to build iOS app
Error output from Xcode build:
↳
2022-05-27 19:18:46.624 xcodebuild[62430:463863] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-05-27 19:18:46.624 xcodebuild[62430:463863] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/6v/14mdnyyd4vs7gh4r1ry0hfxh0000gn/T/flutter_tools.IBcqbj/flutter_ios_build_temp_dirq4Dibw/temporary_xcresult_bundle
Failed to package /Users/bhaskarrajaryal/AndroidStudioProjects/PersonalProjects/FlutterProjects/testing.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
Result bundle written to path:
/var/folders/6v/14mdnyyd4vs7gh4r1ry0hfxh0000gn/T/flutter_tools.IBcqbj/flutter_ios_build_temp_dirq4Dibw/temporary_xcresult_bundle
Could not build the application for the simulator.
Error launching application on iPhone 11.
Can anyone help me with this as I am stuck for fews day because of this?

The problem here is that the Podfile that Flutter template creates by
default has no specific iOS version set unfortunately.
Do this to fix this problem:
in ios/ folder of your project, open the Podfile.
At top of Podfile, make sure this line is not commented out and change the iOS version to 12.0.
change from:
#platform :ios, '8.0'
to:
platform :ios, '12.0'
Run pod deintegrate in Terminal inside the ios/ folder of your project.
Run pod install --repo-update in your ios/ folder
This should do the trick!
If after this you are getting the following error
CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target
Then you need to open your iOS workspace in Xcode and select your root project on top left, then inside the Info tab, choose your configuration (in this case Debug) and change it to None. After that, do pod install again.
HERE PICTURE :
CLICK HERE

Related

Flutter cannot find FirebaseCore.h

I'm trying to build a Flutter app for iOS, but I'm running into a weird issue where flutter build can't locate one of the header files (that's physically where it needs to be inside the Pods directory).
This is what I get when I try to build the app:
:ghost: zmeggyesi#Shiny-Platform:/Users/zmeggyesi/projects/site-overwatch/frontend/ios (tags/release-2.6.0)
$ flutter build ios --release --no-codesign --no-tree-shake-icons
Changing current working directory to: /Users/zmeggyesi/projects/site-overwatch/frontend
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building hu.skawa.dive-site-overwatch-ios for device (ios-release)...
Running pod install... 21.6s
Running Xcode build...
└─Compiling, linking and signing... 12.2s
Xcode build done. 50.8s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Firebase.h"
^
/Users/zmeggyesi/projects/site-overwatch/frontend/ios/Pods/Firebase/CoreOnly/Sources/Firebase.h:15:9: error:
'FirebaseCore/FirebaseCore.h' file not found
#import <FirebaseCore/FirebaseCore.h>
^
/Users/zmeggyesi/projects/site-overwatch/frontend/ios/Runner/AppDelegate.swift:3:8: error: could not build Objective-C module
'Firebase'
import Firebase
^
Command CompileSwift failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
Encountered error while building for device.
And I'm kind of at a loss as to what might be causing this, or how to get around it.
The relevant Firebase declarations in my Pubspec:
firebase_core: 1.1.1
firebase_crashlytics: 2.0.3
firebase_analytics: 8.0.4
firebase_auth: 1.1.4
firebase_remote_config: 0.10.0-dev.3
firebase_storage: 8.0.6
So far, I've tried:
Nuking the Pods directory and the Podfile.
Commenting out the Firebase dependencies from my pubspec, followed by a flutter pub upgrade to update the lockfile, then doing a pod install before re-enabling them to re-download the pods.
Running flutter create . to regenerate the project descriptors.
Nuking the derived data dir (~/Library/Developer/Xcode/DerivedData), the Workspace descriptor, and the Pods/Podfile to regenerate everything from scratch.
This seems to be an issue only since I migrated to Flutter 2 and the latest packages, and only when I try to build in release mode (running the app in debug via XCode or Android Studio seems to work fine).
Correction: now even the XCode native build is broken, with the same error...
Anyone have any more ideas I could try? This is driving me crazy...
try to change global platform in Podfile this:
Uncomment the next line to define a global platform for your project
-# platform :ios, '9.0'
+ platform :ios, '13.0'

Flutter AMSupportURLConnectionDelegate is implemented in both ?? Error

I am facing many issues since I migrated my project to an Apple Silicon mac. I finally managed to reduce the problems but not sure the answer to this.
Running "flutter pub get" in Flutter_the app copy 3... 760ms
Launching lib/main.dart on iPhone 11 in debug mode...
Running pod install... 986ms
Running Xcode build...
Xcode build done. 1.5s
Failed to build iOS app
Error output from Xcode build:
↳
objc[95181]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x20ba238f0) and ??
(0x1160dc2b8). One of the two will be used. Which one is undefined.
objc[95181]: Class AMSupportURLSession is implemented in both ?? (0x20ba23940) and ?? (0x1160dc308). One
of the two will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
↳
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
error: /Users/gorkem/Documents/flutter_workspace/Flutter_the app copy 3/ios/Flutter/Debug.xcconfig:
unable to open file (in target "Runner" in project "Runner") (in target 'Runner' from project 'Runner')
error: /Users/gorkem/Documents/flutter_workspace/Flutter_the app copy 3/ios/Flutter/Debug.xcconfig:
unable to open file (in target "Runner" in project "Runner") (in target 'Runner' from project 'Runner')
error: /Users/gorkem/Documents/flutter_workspace/Flutter_the app copy 3/ios/Flutter/Debug.xcconfig:
unable to open file (in target "Runner" in project "Runner") (in target 'Runner' from project 'Runner')
warning: Unable to read contents of XCFileList '/Target Support
Files/Pods-Runner/Pods-Runner-frameworks-Debug-output-files.xcfilelist' (in target 'Runner' from project
'Runner')
error: Unable to load contents of file list: '/Target Support
Files/Pods-Runner/Pods-Runner-frameworks-Debug-input-files.xcfilelist' (in target 'Runner' from project
'Runner')
error: Unable to load contents of file list: '/Target Support
Files/Pods-Runner/Pods-Runner-frameworks-Debug-output-files.xcfilelist' (in target 'Runner' from project
'Runner')
Could not build the application for the simulator.
Error launching application on iPhone 11.
Is there any way to solve this. I am not sure if the problem is even written in there.
I was getting this error
Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib
NOTE:
Try this first if you have updated to flutter 2.10 from <=2.8
flutter pub upgrade
Solution:
Please open podfile and update with this script
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
flutter clean
flutter pub get
cd ios
pod install
or instead of last command you can try below for M1
arch -x86_64 pod install // for M1
Run your app.
I was getting the same "error output from Xcode build" with my M1 macbook recently as well after updating to Flutter 2.x.
I was able to clear this issue on mine by doing the following:
Change directory to your project's path and sub-directory:
your_project/build/ios/Debug-iphonesimulator/
Run $ xattr -lr Runner.app
Run $ xattr -cr Runner.app
Apparently flutter projects have extended attributes in project app bundles containing Finder info which causes an error.
I found these links that helped for reference.
https://developer.apple.com/library/archive/qa/qa1940/_index.html
https://github.com/flutter/flutter/issues/72492
Try Selecting For install builds only in the run script in the Build phases tab.
Two things need to change:
First check the Dependancy for APNs if need to upgrade. Then Change the version in the POD file and then add
pod 'GoogleUtilities'
To the POD target like following:
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_macos_pods File.dirname(File.realpath(FILE))
pod 'GoogleUtilities'
end
.
After this Run Flutter pug get and Flutter run. It works for me.
Ref screenshot for POD file

ios build error: Multiple commands produce on "flutter run" from command line [duplicate]

Flutter iOS build fails after upgrading to Xcode 10.0 version in mac.
Nagendras-MacBook-Pro:uaenumber nagendra$ flutter run
Launching lib/main.dart on iPhone X in debug mode...
Starting Xcode build...
Xcode build done. 1.4s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
error: Multiple commands produce '/Users/dev/Documents/projects/Personal/uaenumber/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework':
1) Target 'Runner' has copy command from '/Users/dev/Documents/projects/Personal/uaenumber/ios/Flutter/Flutter.framework' to '/Users/dev/Documents/projects/Personal/uaenumber/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 #objcinference” 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/nagendra/Documents/projects/Personal/uaedialer/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 X.
Xcode Version - 10.0 (10A255)
I tried to recreate the project and copied all the source files to the new project folder but it does not resolve the issue.
This solution worked for me.
Open ios/Runner.xcworkspace Select the Runner project in the project
navigator sidebar.
In the main view, select the Runner target, then select the Build Phases tab.
Expand the Embed Frameworks phase and select Flutter.framework from the
embedded frameworks list.
Click - to remove Flutter.framework from the list (be sure to keep
App.framework).
It's a known issue. Here is the explanation and some workarounds:
https://github.com/flutter/flutter/issues/20685#issuecomment-421511890
Affected projects
This issue affects all Flutter projects built using Xcode 10 that have
a dependency on CocoaPods -- typically this means those that rely on
plugins. Workarounds
There are two workarounds:
Option 1: Use the legacy build system . As noted by #gi097, open ios/Runner.xcworkspace, and change the build system to Legacy Build
System.
Option 2: Use the new Xcode 10 build system.
Open ios/Runner.xcworkspace
Select the Runner project in the project navigator sidebar.
In the main view, select the Runner target, then select the Build Phases tab.
Expand the Embed Frameworks phase and select Flutter.framework from the embedded frameworks list.
Click - to remove Flutter.framework from the list (be sure to keep App.framework).
Root cause
When plugins are in use, there are two competing build actions that
copy Flutter.framework into the build application Frameworks
directory:
The Embed Frameworks build phase for the Runner project
The [CP] Embed Pods Frameworks build phase that pod install creates in the project.
Item (1) is there to ensure the framework is copied into the built app
in the case where there are no plugins (and therefore no CocoaPods
integration in the Xcode project). Item (2) is there because Flutter's
podspec declares Flutter.framework as a vended_framework, and
CocoaPods automatically adds a copy step for each such
vended_framework in the transitive closure of CocoaPods dependencies.
If you have tried everything and still cannot build the Archive successfully, then you look like my case.
It took me 3 business days to fix this. My problem happened after adding the Notification Services target to the project. But it looks like it will apply to many other cases as well:
The problem is caused by the library inside 2 target multiple commands produce. In my case, for example, in the project target and notification extension target, both GoogleUtilities had this causing them to conflict or duplicated the commands produce. The solution is to make that dependency explicit, at the top level.
The pod file will look like this:
platform :ios, '10.0'
use_frameworks!
inhibit_all_warnings!
pod 'GoogleUtilities' // Add this line is very important.
target 'MyProject' do
pod 'Firebase/Analytics'
pod 'Firebase/Crashlytics'
pod 'Firebase/Messaging'
# Other pods
end
target 'NotificationService' do
pod 'Firebase/Messaging'
end
After run:
pod deintegrate
pod install
This issue was fixed by opening the Runner workspace project in Xcode 10. Then navigate to File, Workspace Settings and change the build system to Legacy Build System.
Edit: The latest stable version of Flutter will migrate your Xcode project to the new build system (step one below) and avoid the multiple embedded frameworks warning altogether. If it doesn't, follow the instructions at https://flutter.dev/docs/development/ios-project-migration. You no longer need to edit your Podfile (step two below).
See https://github.com/flutter/flutter/issues/20685#issuecomment-622126064
Previous answer
Open ios/Runner.xcworkspace in Xcode. File > Workspace Settings... > Build System, change dropdown to New Build System (Default)
In your Podfile, add the line
install! 'cocoapods', :disable_input_output_paths => true
3. In your Flutter app, build again to trigger a pod install, which will automatically clean up the build phase
flutter build ios
See:
https://github.com/flutter/flutter/issues/20685#issuecomment-509731873
https://github.com/flutter/flutter/issues/20685#issuecomment-510162863
Warning:
Do not revert to the Xcode deprecated legacy build system to fix this issue as suggested in the other answers.
I faced this problem today and nothing fixed it. Then i check my xcode project and i found that insider runner folder i found another runner show red which was not there before. So i delete that and rerun my project and it fixed my problem.
I try the above method but it didn,t fix my problem. But you can try both to see which one work for you.
Try this:
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
rm ios/Podfile
flutter run

Info.plist: Permission denied . Command PhaseScriptExecution failed with a nonzero exit code Xcode 10

I read new instructions in Firebase & Fabric for Crashlytics in Xcode 10.
Reference : https://firebase.google.com/docs/crashlytics/get-started?authuser=0
Xcode 10 only: Add your app's built Info.plist location to the Build
Phase's Input Files field:
I used
"$SRCROOT/DemoProject/Info.plist"
But Getting issue at compile time.
Info.plist: Permission denied . Command PhaseScriptExecution failed
with a nonzero exit code Xcode 10
I have just recently updated the firebase with Xcode 10. Google made it very simple as you just need to follow these simple steps:
Install the latest pods
Add new Run Script in your Target
Install the fabric mac app (Follow the instructions)
Add $(SRCROOT)/Info.plist (in My case) and make sure your .plist file in root folder. Just build + run..
I had exactly the same issue. I did the following:
Removed Firebase from my podfile
Ran pod install (in the project directory)
Deleted the pod and framework file from my project
Added Firebase to my podfile
Ran pod install (in the project directory)
Cleaned the project folder
Build
After these steps I was able to build successfully!
EDIT: Was missing steps 2, and 4!

Xcode /Podfile.lock: No such file

I am trying to run an ionic app on xcode. But xcode throws an apple match-o linker error. I get this error, when I get this after I have runned the following command:
cordova plugin add phonegap-plugin-push --variable SENDER_ID=5****** --save
I need this plugin, for push notifications. After a research on google, I founded that I need to have Cocoapods installed in the projects. But after installing Cocoapods & pod install. I get the following error, when I start the "project.xcworkspace".
diff: /Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
I tried to rebuild/clean project or install pod again. But it did not fixed for me.
Can someone help me?
EDIT -> new Error
Apple Mach-O Linker (ld) Error Group
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am getting this error, when i have fixed the error with pods.
If you are setting up environment setup in your project, you have to choose corresponding pods target in configuration.
Update your CocoaPods installation first ("sudo gem install cocoapods")
then remove everything related to POD from project directory except .podfile.
Run "pod install" on terminal and open your project using workspace file.
1- Remove PODS folder from project folder and then perform pod install and open project using .xcworkspace file.
If above one don't work, go to Xcode Build phase and check for path in scripts added by PODS(usually with pods word in there title), sometimes for hybrid project the path was not correct for podfile.lock and manifest.lock file lookup in the script.
Easiest Solution which worked for me:
Open terminal inside your project directory
Change directory to 'ios' (cd ios)
Type 'pod install' and wait for dependencies getting downloaded and installed
I hope this will help someone out!
In my case, I updated cocoapods and the problem was solved.
gem install cocoapods --user-install
My case, Please:
Xcode → File → Workspace Settings.
Make sure in tag: Build System → New Build System.
Please copy your Podfile.
Delete Podfile, Podfile.lock, Pods Folder in your root app folder, like this.
Next Step, Open <YourProject>.xcodeproj. You should use Terminal by:
open <YourProject>.xcodeproj. (Remember not .xcworkspace)
In Pods tag, delete these files, like this:
<Pods-YOURPROJECT>.debug.xcconfig
<Pods-YOURPROJECT>.release.xcconfig
Pod init and Pod install your Project again.
Open <YOUR PROJECT>.xcworkspace, with Terminal: open YOURPROJECT.xcodeproj
CMD+SHIFT+K to clean build.
CMD+B to build again.
Enjoy
Last year I had used the similar plugin, when I was working on an App Update, I came to know that this plugin got deprecated. Not sure about the above one.
So I've working using FCM. I had the similar problem while working with FCM. After having spent nearly a day on researching on this I've found a cordova plugin which takes care of pods in cordova.
Plugin name:
cordova plugin add cordova-plugin-cocoapod-support --save
Please Note: After installing this plugin, there's no need of podinit, or opening the pod and installing it. This plugin will take care of it. It will create a AppDelegate inside the plugin folder where it will handle everything - you can retrieve Push Token as well in DEV mode if you wish.
After I installed this plugin and build iOS, there were no issues.
** Note **
Please ensure while working with FCM, no other google plugins are installed, they'll conflict. Earlier I had GoogleAnalytics plugin, as it's now covers within FCM - you can remove Old GoogleAnalytics plugin in order to work with FCM without issues.
For my Cordova project doing pod init in the ios folder fixed the issue.
From your Cordova project root directory you would:
cd /platforms/ios
pod init
cd ../../
cordova build ios

Resources