Why does my Flutter app crash on some iPhones? - ios

I've created an app using Flutter and successfully published it to the App Store. During my testing I have never experienced any crashes (both on Simulator and on a physical iPhone), but some users have reported that the app immediately crashes on startup.
The crashes seem to happen randomly (as in some users experience crashes but others don't, and there doesn't seem to be any similarities in the devices that the crashes happen on).
FYI, compiling for Android still works and I have not experienced any crashes for Android at all.
While trying to solve this problem I have tried to modify Info.plist for both debug and release versions, but now when trying to build the app for iOS (Simulator and physical devices) the build is stuck on trying to compile my main file.
Info from flutter run -v:
... logs ...
[ +3 ms] executing: [/Users/ashley/Documents/attendance app/attendance_app/ios/] /usr/bin/arch -arm64e xcrun xcodebuild -list
[ +7 ms] <- compile package:attendance_app/main.dart
It gets stuck on this last line for over 30 minutes (I stopped it after that) when trying to compile main.dart.
Does anyone know how to resolve this? Thanks.

Related

Getting frequent Kill:9 Error in Xcode and Terminal

I have recently upgraded the Mac OS to Ventura 13.2.1 and Xcode to 14.2, now once I try to compile any application with Xcode, I am getting Kill:9 related issue for random task/framework in the project. I also get Kill:9 issue sometime on terminal as well.
Listing the errors here:
failed to read asset tags: The command `` terminated with uncaught signal 9. The command had no output.
Driver threw jobFailedWithNonzeroExitCode(9, "") without emitting errors.
Unable to execute command: Killed 9 Clang frontend command failed due to signal.
Please help me to resolve this issue/crash.
Open project in Xcode.
Build the app with Simulator (I tried with iPhone 14 Pro)
Error occurs in the build
Ideally project should have compiled without any error.
It sounds to me that the problem is with the installation of Xcode because when an unprivileged task is attempted, the OS will kill it off (with signal 9).
What I recommend is for you to re-install Xcode.
When you first run the new Xcode, it should prompt you for an administrator password in order to install system related components. Make sure you do this step. Hopefully that should then allow you to compile and run your iOS apps.

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.

Xcode will run the Unity app on device, but when I run the built app, the black screen will appear

environment:
Develop OS:macOS Catalina 10.15.5
Xcode:11.5
Device OS: iPhone 7 Plus (iOS 13.5.1)
Unity : 2019.3.9f
I built the iOS app with Unity.
When I play on the Running on device on Xcode, the app works normally.
However, when I turn off the Xcode and turn on the built app, the black screen comes out and stops.
If I run it on the simulator to check the log, the following log occurs.
Could not find and/or execute program specified by service: 86: Bad CPU type in executable: /Users/develop/Library/Developer/CoreSimulator/Devices/31985C61-CACF-40D6-8A48-A2BA2BAF0DDD/data/Containers/Bundle/Application/EC20344C-A067-4379-A9EA-CE0E42F3C106/make.app/make
Service setup event to handle failure and will not launch until it fires.
Service exited with abnormal code: 78
But when I play on the Running on device on Xcode, I can't understand the app running normally.
I tried the Unity version 2018 to figure out the problem, but it works well. However, when I upgraded the Unity version to 2019, the above problem occurs.
I want to know the causes and solutions of these problems in Unity 2019.
On Xcode
Go to Unity-iPhone - Build Phases - Link Binary with Libraries build section
Add UnityFramework.framework
This happens on Unity 2019/2020

react-native app crashes when distributed

When running the app on a simulator (or on a connected iPhone), I have no trouble running the application.
However when I archive the app in xcode (build succeeds) and distribute it using either HockeyApp or Fabric, the app installs just fine, but upon opening the app, it crashes right after the splash screen.
The log-file that is being generated on the iPhone does not give any useful information
On the Fabric/HockeyApp dashboard no crashes are being registered.
Any advice on how to get a stack trace or other useful crash log?
When running the react-native app using react-native run-ios --configuration Release, I was able to reproduce the error in the simulator and fix the JS error that was somehow not appearing running in debug mode. Logs for the Simulator can be found at
~/Library/Logs/CoreSimulator

Resources