Problem with running IOS simulator for my flutter app - ios

I'm trying to run my flutter app on the IOS simulator and its not working. So tried on the most basic flutter app (create my_app and then tried to run it) and nothing seem to work!
Everything seems to work fine when I run it from the terminal until the linking and signing phase and that where I get the error, how can I fix it?
This is the error I get:
Unable to install
/Users/MyUserName/Desktop/my_app/build/ios/iphonesimulator/Runner.app on
82562E3A-E7BD-4FE0-9BF9-8BB9C7AD5F15. This is sometimes caused by a malformed
plist file:
ProcessException: Process exited abnormally:
An error was encountered processing the command
(domain=IXUserPresentableErrorDomain, code=1):
This app could not be installed at this time.
Could not install at this time.
Failed to transfer ownership of path
/Users/MyUserName/Library/Developer/CoreSimulator/Devices/82562E3A-E7BD-4FE0-9BF9-8B
B9C7AD5F15/data/Containers/Shared/SystemGroup/systemgroup.com.apple.installcoord
inationd/Library/InstallCoordination/PromiseStaging/98CD703F-760F-4AAE-B991-BC2E
82D37D17/my_app.app to installd
Underlying error (domain=MIInstallerErrorDomain, code=103):
Failed to transfer ownership of path
/Users/MyUserName/Library/Developer/CoreSimulator/Devices/82562E3A-E7BD-4FE0-9BF9-8
BB9C7AD5F15/data/Containers/Shared/SystemGroup/systemgroup.com.apple.installcoo
rdinationd/Library/InstallCoordination/PromiseStaging/98CD703F-760F-4AAE-B991-B
C2E82D37D17/my_app.app to installd
Command: /usr/bin/xcrun simctl install 82562E3A-E7BD-4FE0-9BF9-8BB9C7AD5F15
/Users/MyUserName/Desktop/my_app/build/ios/iphonesimulator/Runner.app
Error launching application on iPhone 11 Pro Max.
Edit:
I updated my MacOS, Deeleted and reinstalled Xcode, I even tried to run the most simple swift app and I get always this same error, it looks like the build was successful but it unable to install. I still get this same error, what can I do?

This occurred when I opened the Simulator first and then updated XCode -- even without running the app until after XCode updated completely.
What worked for me:
Close Simulator completely (from the dock, right-click -> "Quit")
Close XCode (if applicable)
Run flutter clean
Re-open Simulator
Re-open XCode and let it compile
Run the app again
If it still does not work, try resetting the device at "Device" -> "Erase All Content and Settings..." from the Simulator menu.

I had the same issue a couple of days ago
What I did - and what fixed the problem - was to reset the simulator (Device -> Erase All Content and Settings), and then run $ flutter clean
You should now be able to run your app again

None of the above worked for me. I created another flutter application and copied it's ios folder to my project. Worked like a charm

Save time, just go to erase device content and settings from the emulator, then run flutter clean. App should run fine then.

Run flutter clean and then run your app again
If error persist, generate a new flutter project on Android studio. Replace the ${projectHome}/ios/Runner.xcodeproj folder with the ${newFlutterProjectHome}/iOS/Runner.xcodeproj. Your app should run fine now.
If error persist still, delete the ios folder and replace it with a new one copied from a freshly generated project.

This happens if the GoogleService-Info.plist is missing.

This also happens when you have updated your XCode and your simulator is in the background.
Close the simulator and open the Xcode, you will get an option to install additional tools, install them and then run the application.

An alternate solution is to run the Runner.xcworkspace app once from Xcode and this may fix it.

In my case it was because of hanging empty GoogleService-Info.plist file inside Xcode after migrating to new Firebase (FlutterFire) initialization.
Xcode is not a regular drag and drop IDE which directly maps project files to the ones in the file system. It rather caches file references. So even when you delete a .plist file, the Xcode still maintains a reference to it.
Simply opened Xcode IDE and removed .plist file (which updated project.pbxproj in turn). This helped me to compile the project fine.

I had this same issue recently. I found out I added my GoogleService-info.plist file to the subdirectory Runner and not the main Project directory Runner through xcode. I opened up xcode again, deleted the file and re-added it to the proper place and now everything is working correctly.

for this you have to give some value in CfBundleVersionShortString like
<key>CFBundleShortVersionString</key>
<string>1.0</string>
And Give the build value in Runner as 1.0 and version as 1.0
enter image description here

To be honest. it's really frustrating for the developers
This is how I fixed!
flutter clean
flutter pub get
go to ios folder
rm Podfile.lock
pod repo update
pod install
Then it works!

Related

Xcode 12 error in installing app -Failed to get FD to bundle executable

My project is running fine in Xcode 11.3 but recently when I upgraded to Xcode 12 app is not getting installed in simulator and showing the error - Could not install at this time.
Failed to get FD to bundle executable....
I suddenly had the same problem, after years of work on the same project across several versions of Xcode and MacOS.
On Xcode 12.4 and MacOS 10.15.5, although everything was working fine, suddenly I got this error popup "Failed to get FD to bundle executable" while trying to Run the project on a(ny) Simulator.
I tried all the proposals I could find online, including changing the Executable Type (which had never changed) or clear the empty env vars defined in the Build settings (there weren't any). Uninstalling/reinstalling Xcode didn't help. Upgrading to MacOS 10.15.7 didn't either. Of course the Apple Support has been of no use at all (they replied with a few general FAQ links about how to use Simulator).
The only thing that worked for me was to checkout the project in a different folder...
The weird thing is, if I rename again my new folder to the initial folder name, it does the error again! It sounds to me like a MacOS bug and/or an Xcode bug.
Error running `xcrun simctl install 95F3A7B0-67B3-490E-B798-D1CBBF813B83 /Users/yakjuly/.expo/ios-simulator-app-cache/Exponent-2.21.3.tar.app`: An error was encountered processing the command (domain=IXUserPresentableErrorDomain, code=1):
Unable To Install “Expo Go”
Please try again later.
Failed to get FD to bundle executable at /Users/yakjuly/Library/Developer/CoreSimulator/Devices/95F3A7B0-67B3-490E-B798-D1CBBF813B83/data/Library/Caches/com.apple.mobile.installd.staging/temp.Nf39ZM/extracted/Exponent-2.21.3.tar.app/Expo Go
Underlying error (domain=MIInstallerErrorDomain, code=4):
Failed to get FD to bundle executable at /Users/yakjuly/Library/Developer/CoreSimulator/Devices/95F3A7B0-67B3-490E-B798-D1CBBF813B83/data/Library/Caches/com.apple.mobile.installd.staging/temp.Nf39ZM/extracted/Exponent-2.21.3.tar.app/Expo Go
I have this problem when I get started with react native.
The issue for me is the file in /Users/yakjuly/.expo/ios-simulator-app-cache/Exponent-2.21.3.tar.app is broken. After I delete this file and re-run the command. it succeeds installing app in iOS simulator.
What solved this for me was the following:
close emulator
clean project and build folder
Shortcut: Command+Shift+K
GUI: Menu Bar -> Product -> Clean/Clean Build Folder
restart emulator
Xcode 13.2.1
The following steps helped me -
1. Select simulator
2. Goto Device
3. Select -> Erase All Content and Settings...
Hopefully, now you will be able to install and run the app on your simulator.

Unable to build app for iOS, "unable to write module session file Session.modulevalidation No such file or directory"

yesterday I was working fine with Flutter, now i'm facing this issue and I already search everywhere for a solution but no success.
When I run:
flutter run
The build process starts and when its about to finish the error below is shown:
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Xcode build done. 12.3s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
error: unable to write module session file at '/Users/hencke/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation': fopen(/Users/hencke/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation, wb): No such file or directory (2)
note: Using new build system
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
Exited (sigterm)
Looks like the process is trying to open this file Session.modulevalidation for writing, but this file really does not exist in that folder. And I don't know what to do.
Things that I already tried:
Reinstalling xcode
flutter clean
Clone my project again in another folder and try to build, but same error
Created a new flutter dummy project and tried to build, still same error
Rebooting machine several times
Give permissions to Staff to the DerivedData and ModuleCache.noindex folders
Deleted the DerivedData within hope that xcode build will recreate all the files needed, but, it created everything again but not that particular file.
So that's it, If any blessed human know how to 'recreate', or reset, clear some cache, I would be very thankful.
Before running your project, check everything is checked when running:
flutter doctor
and also make sure at least a device is connected or open iOS simulator first. You can check if flutter is successfully connected to the device by:
flutter devices
when you make sure that flutter detect your device or the simulator, then run your application by:
flutter run
After hours I finally found the solution as it follows:
Without any hope I opened my flutter project with Xcode, and then tried to build the Runner target from there, same error.
Then, I was browsing the Xcode preferences and something caught my attention, on Locations section I found something about DerivedData location, it was set as Default. So, I changed from Default to Custom location and I set to a new folder on my home directory:
Then immediately Xcode created the entire DerivedData/ModuleCache.noindex folder and with them, the Session.modulevalidation file as well.
Then I closed Xcode and tried flutter run again, and it was successfully build!
I'll let this answer to those who may come here for help.

Xcode crash on opening .xcodeproj file

I am running my React-Native iOS project with Xcode but I don't know which change effects it and my I notices that my Xcode is crashed then I try to open it inside Xcode but it crashes every time then I deleted derived data and also xcuserdata from .xcodeproj file but no success I also tried to use this command "defaults delete com.apple.dt.Xcode" but again no luck I have also looked into .xcodeproj file for conflicts but there is no conflicts I try to run my project with command line but again got this message.
"error Failed to build iOS project. We ran `xcodebuild` command but it exited with error code null. To debug build logs further, consider building your app with Xcode.app, by opening `.xcodeproj`
Can anyone please suggest me a solution for this ?
Delete derived data of xcode and also of project.
react-native run-ios
"error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code null. To debug build logs further, consider building your app with Xcode.app, by opening Raydan.xcodeproj"
I tried almost everything on the internet like.
Deleting Xcode derived data.
Try with .workspace file.
Deleting xcuserData.
but nothing works, At last, I found this problem with react-native-fast-image, upgrading to react-native-fast-image v7.0.0 was causing the problem so downgrading react-native-fast-image to v5.1.2 works for me.
here is the issue reported in their Github.
https://github.com/DylanVann/react-native-fast-image/issues/527
In my personal experience working with React-Native and XCode you should try deleting the build folder for android and/or iOS for whichever you are using it for. Every time you run your code it should re-create a new build once it is deleted.

Flutter, Cannot Build For iOS: Missing .h-Files

Building our Flutter project fails on iOS. The following steps work without problems:
running on the XCode simulator (flutter run)
building in the terminal (flutter build ios)
running on a real device in debug mode (flutter run -d "abcd")
If I open the project in XCode, change the build target to "Generic iOS Device" and hit "Build" or "Archive" I get the following error:
/Users/.../development/testproject/ios/Runner/GeneratedPluginRegistrant.m:6:9: 'flutter_exif_rotation/FlutterExifRotationPlugin.h' file not found
After removing the FlutterExifRotationPlugin, the error reoccurs with the next plugin alphabetically, so I figured that plugins in general don't work at the moment.
I tried:
dev, stable and master channels of flutter
reinstalling XCode
reinstalling Flutter
create a new project and moving the old files there
But nothing worked so far.
Ok the solution was very simple. I had to open the .xcworkspace file instead of the .xcodeproject one.
One WEEK went down the pipe for this error. I hope that you, future reader, will find this comment useful.

Removed PrivateFrameworks from /Library/Developer/ Xcode crashing on launch

Is there a way to download this /PrivateFrameworks folder back? It seems like this has the framework to make simulator work. I have re-downloaded xcode9 and it does not come back. Also tried re-installing xcode command line tools but this PrivateFrameworks doesnt seem to be part of the Xcode bundle nor the Command Line Tools bundle. Idea's Anyone?
There's no need to get a copy from a friend. The contents of PrivateFrameworks come inside an installer package provided with Xcode starting from version 9. You should have this file as part of your Xcode install, even if you just downloaded Xcode from the App Store.
Just run in your Terminal:
open /Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg
And your PrivateFrameworks folder will magically be back. 🙂

Resources