Can't run flutter app on physical Apple devices - ios

I have a perfectly working Xcode (at least for Swift iOS projects), today I tried to install flutter.
I followed the steps from here: FlutterDev (every step, so the solution is not here)
I can build and run Flutter projects in terminal on Simulator on iPhones and Android Virtual Devices as well.
Flutter doctor found everything OK.
But I can't run it on any physical Apple device. Tested on 2 MacBook Pros -> deploying to 3 different iPhones.
I got SIGABRT error right after the app tried to launch if I run the from Xcode, and the terminal stuck in installing and launching... if I try to run the app from there.
Terminal
Xcode

Maybe you should just try these steps:
1) flutter clean
2) flutter build ios --release
Then later do this in Xcode MenuBar: Product -> Clean and then build in Xcode

It is a bug from Flutter. Instead switch the channel:
flutter channel dev
flutter upgrade
flutter run
But remember: The dev channel is far ahead of the stable one, it is little less safe. I would recommend you to use it just for running the app on your device. For coding etc. switch back to the stable channel:
flutter channel stable
flutter upgrade
The bug will be fixed in v1.15.3.

After I've spent my day troubleshooting the only solution that worked for me is to download xcode beta, the newest 13.4 iOS beta and then everything worked immediately. I opened the existing projects, hit run and opened on my phone without any extra steps.

Related

React Native Expo Managed App doesn't launch/start on iOS simulator

I've been having hard times with my old Windows laptop while developing React Native apps so I moved to MacOS laptop. I installed Android Studio and Xcode (including Xcode command line tools). Then I initialized a blank expo managed project. I started both on Android Emulator and iOS simulator. Android one worked out with an ádb´ error (or maybe warning). But on the other hand, iOS simulator did nothing. There's no Expo Go app installed on iOS device, so it can not launch my app using it. I don't get any error or warning related to this problem, so I can't trace the problem.
I have tried deleting global expo folder located at ´~/.expo/´, I also tried to give 777 (all permissions) on that folder to my current user.
I tried uninstalling and reinstalling expo package globally.
I made sure I have selected Xcode command line tools on ´Xcode -> Preferences -> Locations -> Xcode 13.2.1 (13C100)´
I tried to launch different iOS devices like (iPhone 6, 8, 13, iPod etc.)
I tried clearing cache and starting expo with ´sudo npm start --clear-cache´
I have been trying to solve this for at least 2 hours tried everything possibly related to my problem but none of them did work. There's one thing I don't understand though. Even though I used different iOS device simulators the Expo Metro Bundler showed this ´› Opening exp://10.42.33.15:19000 on iPhone 8´ output. I have tried iPhone 13, iPhone 6, iPod etc. but this was the same output for different devices. Here's some screenshot related to probem:
https://www.youtube.com/watch?v=dvuZn6gX_Q4
This tutorial video on YouTube helped me solve my problems. I think I was missing a few things:
I haven't granted required privacy permissions on my Mac for Xcode, Android Studio and VS Code. Open System Preferences > Security & Privacy > Go Privacy Tab > Give Full Disk Access to Xcode, VS Code, Android Studio, Terminal and Watchman (Watchman is not required, but I have also installed it for solving a problem before)
You should to launch both your Android and iOS simulators before starting your expo application. Simply go to Android Studio and launch your device. To launch iOS device use bash and type open -a simulator.
If you don't have Expo Go app installed on your iOS simulator then you should first install it before starting your expo app. To install it use expo client:install:ios command.
Start your app by using expo start command. Type i and a or click on Run on iOS simulator and Run on Android device/emulator buttons to launch your app on devices.
NOTE: If you app gets stuck at New update available, downloading... stage then you can start your expo app with cleaned cache using expo start -c command. It was helpful for me.
NOTE 2: You may need to use sudo command on some of the commands I've mentioned, I'm not sure which ones are required or not.
I run into the same issue every time when I tried to set it up on a new laptop.
Its fixed after the installation of xCode cli.
Take a look at this - https://docs.expo.dev/workflow/ios-simulator/
I fixed similar issue by hard restarting simulator
Top menu -> Device -> Erase All Content And Settings...

iOS Observatory not discovered after 30 seconds. Error launching application on iPhone

I'm unable to debug a freshly created app on physical iOS devices when pubspec dependencies reach a certain size, because it causes the "waiting for observatory port" step to timeout after 30 seconds.
Devices tested:
iPhone 12,
iPhone 12 Pro
iOS versions tested:
14.7.1,
14.5
The app runs properly on emulator but not on ios real device.
How do I fix this issue?
This Error message occur when your iPhone is busy processing something. For example as below.
If you run Flutter doctor you will see message as below.
Error: iPhone X is busy: Fetching debug symbols for iPhone X. Xcode will continue when iPhone X is finished. (code -10)
To confirm I opened xCode -> windows -> Devices and Simulator and it was showing the progress. Let the progress complete and then confirm by running Flutter doctor to make sure there is no error message.
Had the same problem after updating Xcode and running for the first time. As mentioned on the this github issue (https://github.com/flutter/flutter/issues/72161#issuecomment-994653225) I simply:
Opened ios/Runner.xcworkspace with the iPhone connected
Waited until "Fetching debug symbols" process finished
Closed Xcode
Run again from IDE and it worked!
I have encountered the same issue and following this process has fixed the problem for me on 14.7.1 and 14.8:
Uninstall the app
Restart the phone
Open the app using Xcode
Run 'flutter clean' for the project
Now it should work if you run it again.
If it still doesn't work you could try increasing the observatory timeout (the default appears to be 30 seconds):
localUri = await observatoryDiscovery.uri.timeout(const Duration(seconds: 30));
I'm not 100% sure why this problem appears inconsistently, but there is a lot of related discussion at the following link:
https://github.com/flutter/flutter/issues/72161
For coders who are as lazy as me, you could take these steps:
Open xcode for the project:
Run the project from xcode:
while(prompt_below_finished == false) wait for some time || make a coffee;
Runs successfully. As for me, next time I ran with android studio , it run smoothly
run your project through Xcode, not from Xcode or Android Studio. it will show different error message.
when I run the Flutter project using Xcode, the error message was
"The sandbox is not in sync with the Podfile.lock..."
to solve this, I run pod install on the ios folder. run these 2 commands below on your terminal
cd ios
pod install
I have tried all the solutions here and for me the simplest works:
move you Android Studio in the trash, download it and reinstall. for me the problem was with Android Studio 2021.1.1 Patch but I got there with several updates. a clean install solved the problem.
In My iPad case, It showed a white screen after compiling in the installing step for 5-10 minutes & it worked at the end without doing anything
Try updating your Xcode and MacOS to the latest versions.

Not able to build for IOS after flutter upgrade to 1.20.2

I am facing the issue after upgrading to stable flutter version 1.20.2. I am not able to run on IOS. when I start debugging I get this error.
Xcode build done. 48.6s
Failed to build iOS app
Exited (sigterm)
Could not build the application for the simulator.
flutter run -v
Before that, I was on flutter 1.17.5 and everything was working. It is happening on all of my projects. How to resolve?
It happens to me also after Upgrading flutter, My project does not work.Then i create new project and copy paste previous code in new projects.This works for me because previous projects have old dependencies.Try it

Flutter app stuck on Installing and Launching step for physical iPhone

Annoying problem here for my Flutter app: iOS13.3, Xcode11.3 on a physical iPhoneX. The iOS-Simulators all work. The problem is only happening on a physical device. The Flutter App freezes at startup (i.e. at Installing and Launching... step) ! Any ideas ??
My flutter doctor -v does not bring any problems. Also tried flutter clean and flutter upgrade. But nothing seems to fix the problem...
If I run the App from Xcode (Runner.xcworkspace) then everything works as well. Only from VSCode and Flutter, I can no longer launch my physical iPhoneX.
Also, when uploaded to TestFlight, the App freezes at App Start ! (grey screen freeze). Therefore Apple App Store rejects all Flutter Apps for now ! Very annoying.
I am not sure if the Installing and Launching... freeze is related to the TestFlight and App Store Problem !! Might as well be...
This fixed the issue for me:
Run the app from Xcode.
Disable WiFi on iPhone.
Run from Android Studio.
Turn on WiFi on iPhone once the launch process has completed.
This is a workaround solution
I was having this issue. I uninstalled the app from my device, opened the project in xcode, ran some build cleaning thing that appeared in the yellow triangle warning area, then built the app via xcode. Then uninstalled the app from device again. Then ran via android studio and it worked.
Basically, it is because of might some files
For me, this worked
Follows these steps: Go to Flutter > bin > cache
and delete the Artifact folder
Try executing the command: killall -9 dart and retry.
As in my case, I use one of following solutions to fix the issue:
#1. close WiFi on mac, then run from Android Studio; OR
#2. close WiFi on both mac and iphone, then run from Android Studio; OR
#3. enable hotspot on iphone and connect it from mac, then run from Android Studio;

WebStorm - React-Native App simulator not working

I created a brand new React-Native app using WebStorm. When I click on Run -> iOS to fire in iOS simulator, I don't see iOS simulator loading. I don't see any errors also. Here is the screenshot after I run the project.
Now I could run react-native run-ios to get iOS simulator to work (btw which works), but I would like WebStorm to fire simulator so that I can use in-built debugger in WebStorm.
What webStorm and react-native versions do you use? looks similar to WEB-29569, fixed in 2017.3
It's possible that WebStorm uses not latest version of react native that caused some troubles with Xcode version.
First you need to upgrade your Xcode to currently latest version.
Second you would better use stable version of Node JS.
I recommend you not to create app with WebStorm. For today the best way to create new app is create-react-native-app command line tool. It will create app using expo kit. As app will be initialized - run npm start (or better yarn start if you have it, because yarn is optimized version of npm). As it loaded it will show you QR code in terminal witch is you should read with your device and it will install Expo App and open your app inside it. Also you can press i to run iOS simulator.
Here is short documentation for creating app with create-react-native-app. Follow this steps and everything will be all right.
https://facebook.github.io/react-native/docs/getting-started.html

Resources