Flutter iOS App not launching after removing USB - ios

So i'm testing a flutter app that builds and installs successfully on an iOS simulator as well as a physical devices. However, when building and installing the app with xcode via the USB, it successfully installs and launches but when the USB is disconnected from my mac and i try to run the already installed device on the iPhone, it shows only the launch / splash screen and fades and closes.
Is there something i'm doing wrong that causes this to happen? As the app works fine when connected with the USB and it's being run.

If the build is in debug mode - it won't open.
if you want to open application after disconnecting, try profile / release mode
flutter run --profile
or
flutter run --release

In iOS, debug build doesn't work without USB. To use the app without USB trying making a release build using flutter run --release

Related

How to launch my Flutter app without the host computer?

I wanted to know how to launch my Flutter app without the host computer on my iOS 14+ devices. Because I disconnected to my host computer and it gave me some error, so that I don't have to go back to my Mac everytime and rebuild that app.
You can just run this command in your IDE (I did it with VSCode)
flutter run --release
It worked for me!

No internetconnection deploying Flutter App (release) on IOS(14+) device

I'm trying to deploy my Flutter app on a iPhone IOS 14.4. IOS 14 don't support debug mode, so I run "flutter run --release". But when I open the application on my iPhone, it won't connect to the internet and my database. It works well on my Xcode IOS simulator in debug mode. I think it has something to do with release instead of debug.

Physical device (iPad) not detected in vs code for flutter but detected and working proper for debugging in Xcode

Here's my Environment
Xcode Version: 11.1 (11A1027)
Physical device: - iPad mini 2 (IOS 12.4.2)
VSCode Version: 1.39.2
Flutter version: 1.9.1+hotfix.6
When I use the iOS part of the Flutter project and run it physical device using XCode, it detects the device and works fine but I am somehow not able to see the device on the available devices section on VSCode.
However VSCode detects and works fine with the simulator.
I also ran flutter doctor to see connected devices, but again it does not show the connected physical devices but shows the simulator created device.
Use rm -rf <flutter_repo_directory>/bin/cache to force delete the files in cache and then flutter doctor -v to reinstall the missing sdk directories.
Deleting the cache in flutter/bin/cache directory and then reinstalling the dart sdk solved this issue.
Referred to this issue in Flutter repository(Issue No:41006).
I had the same issue. In my case, a recent iOS update had turned off Developer mode, for some reason... So I needed to enable it again (Settings - Privacy & Security - Developer Mode).
iPadOS / iOS Devices Setup for Hot Reload
Before trying to flutter Debug on physical device from Vscode it is Required to first :
Run a successful Xcode build on that iOS or iPadOS device
Follow this steps if you don't know how to Run Xcode Build -> your device should then be detected by flutter :
Open Xcode & do all the classic Set Up (Signing in with a Team & choosing a UNIQUE bundle Identifier)
Set Your iPhone Auto-Lock to Never (& Unlock it !) - Connect your iPhone or iPad to Mac with USB cable & Accept Prompt on the iPhone
Run Xcode Build on your iPhone this alert prompt will select Ok
On your iPhone a new menu will have appeared - Navigate to it & Click « Verify App » or « Accept »
Now Run Xcode Build Again - if does not run try running flutter clean & flutter build ios & try running again
—
After Successful Xcode Build - Stop Running the App
Keep Xcode Open
— iOS Setup is done
Close all Simulators or Emulators - Close VsCode
run flutter devices to make sure your Device is now detected
if it’s not try Turning it off & plugging it back again - remember to accept Trust Computer Prompt - keep it device unlocked too !
Open back your project in VsCode or Android Studio
Hot Reload⚡️Using VsCode :
Press F8 or Select ▷ « Start Debugging » in main.dart
That’s it ! You now have the power of Hot Reload⚡️ with VsCode on a physical device !
Hot Reload using Terminal Commands :
run flutter run -d yourDeviceID
Have fun ! Press r in Terminal for HotReload⚡️
If you need to find your iOS device ID :
Select Add Additional Simulators
Hot Reload⚡️on Android Studio :
Select your device & run
All I had to do was to disconnect the device from the laptop, make sure VS Code is open, then connect the device again while no VS Code, then it detected right away and chose the device automatically.
Sometimes it doesn't detect the device if it is not directly connected to the computer. I had a docking station in between and it didn't recognized the device. Especially after you have updated you macOS just before.
With "focus mode" activated on the device (like "do not disturb" 🌙) it won't show up.
Check whether you have fully installed xcode by running flutter doctor -v
Incase you find that some thing like
[!] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
just run install Xcode and run
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
Incase you installed xcode already, just run the above commands, they will do the magic.

How do I get a Flutter release iOS app onto my iPhone?

I want to test a release build of my Flutter 1.9 iOS app on my iPhone without going through the App Store. The development build from IntelliJ runs just fine on my iPhone, but I want to see the real performance characteristics.
The Flutter documentation describes how to build a release version of the app. This creates build/ios/iphoneos/Runner.app in my project. But how can I get Runner.app from my Mac onto my iPhone?
With flutter run --release -d [device name], you can run the Flutter app in release mode either in a simulator or on a real device. Thank you, Chenna Reddy!

Targeting a particular device in the iOS simulator using Meteor

I'm currently developing a mobile app using Meteor v1.0 and trying to test iOS devices using the iOS Simulator.
For Cordova apps, I'm used to doing something like:
cordova emulate ios --target "iPad"
For Meteor, the alternative is:
meteor run ios
On my Mac, running the above Meteor command leads to the app being run on an iPhone 4S emulator. I'm unable to choose what device to emulate like I could when using Cordova.
I've tried switching device through the iOS Simulator after the app gets loaded initially but the app is not available on the device I switch to.
The only solution I have found is to navigate to the Cordova directory (.meteor/local/cordova-build) and run the iOS Simulator directly from Cordova.
Does anyone know a better solution by using Meteor itself or is this not currently possible? I haven't been able to find anything in the documentation. I'm open to testing it using something else but it would be nice to keep everything together with Meteor.
The current solution is to open Xcode by running meteor run ios-device and then select the correct simulator inside Xcode. Unfortunately, ios-sim (the package Meteor uses for the simulator) doesn't make it easy to select the device to simulate.
meteor run ios-device -p 3000 is what I do. Then download the phone gap app for iPad and run it on your IP:
ipconfig getifaddr en0
Then put that in on the phone gap app. So example: 192.168.0.8:3000

Resources