Marr
Marr

Reputation: 615

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?

Upvotes: 44

Views: 37004

Answers (9)

Mijawel
Mijawel

Reputation: 419

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

Upvotes: 13

Amer Al zibak
Amer Al zibak

Reputation: 1961

in case you are running your flutter app on iOS by Wireless debug, you may have to wait 10 minutes until it's ready.

Upvotes: 0

Abdelrahman Tareq
Abdelrahman Tareq

Reputation: 2317

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

Upvotes: 0

Agung
Agung

Reputation: 13853

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

Upvotes: 1

Khamidjon Khamidov
Khamidjon Khamidov

Reputation: 8999

For coders who are as lazy as me, you could take these steps:

  1. Open xcode for the project: enter image description here

  2. Run the project from xcode:

enter image description here

  1. while(prompt_below_finished == false) wait for some time || make a coffee;

enter image description here

  1. Runs successfully. As for me, next time I ran with android studio , it run smoothly

Upvotes: 10

bl4ckr0se
bl4ckr0se

Reputation: 624

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.

Upvotes: 0

Ben Villamayor
Ben Villamayor

Reputation: 411

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!

Upvotes: 37

Deeps
Deeps

Reputation: 4577

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.

Upvotes: 81

Micheal C Wallas
Micheal C Wallas

Reputation: 525

Try updating your Xcode and MacOS to the latest versions.

Upvotes: -4

Related Questions