Hkm Sadek
Hkm Sadek

Reputation: 3209

Flutter run lost connection to device in iOS

I did an app in android, now trying to run it in ios. I am getting the bellow error

    Xcode build done.                                           35.2s
    Configuring the default Firebase app...
    Configured the default Firebase app __FIRAPP_DEFAULT.
    6.34.0 - [Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not exist.
    6.34.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60900000 started
    6.34.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see ....)
    Waiting for iPhone 11 to report its views...                         4ms
    6.34.0 - [Firebase/Analytics][I-ACS025036] App Delegate Proxy is disabled
    Lost connection to device.                                              
    Syncing files to device iPhone 11...                                    
    (This is taking an unexpectedly long time.)   

I have other ios apps which are running perfect.

Running flutter doctor shows this

    flutter doctor
    Doctor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (Channel stable, 1.22.4, on macOS 11.0.1 20B50 darwin-x64, locale
        en-GB)
    
    [!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
        ! Some Android licenses not accepted.  To resolve this, run: flutter doctor
        --android-licenses
    [✓] Xcode - develop for iOS and macOS (Xcode 12.2)
    [!] Android Studio (version 3.1)
        ✗ Flutter plugin not installed; this adds Flutter specific functionality.
        ✗ Dart plugin not installed; this adds Dart specific functionality.
    [✓] Connected device (1 available)

    ! Doctor found issues in 2 categories.

Edit = Removed firebase

I removed the firebase thing and getting a plain message like this

     Running pod install...                                              3.0s
    Running Xcode build...                                                  
    └─Compiling, linking and signing...                         9.1s
    Xcode build done.                                           35.8s
    Waiting for iPhone 11 to report its views...                         3ms
    Lost connection to device.                                              
    Syncing files to device iPhone 11...                                    
    (This is taking an unexpectedly long time.)       ⣻

Any idea what could be wrong?

Thank you.

Upvotes: 1

Views: 4349

Answers (3)

Daniel Reghin
Daniel Reghin

Reputation: 31

You may be creating a Secondary App as described in FlutterFire docs. https://firebase.flutter.dev/docs/core/usage/

The Secondary APP just worked in an Android Environment for me. I found a workaround loading the options from the previously created. In that way, it worked in IOS.

Something like this:

// Uses the default GoogleService-Info.plist
final Future<FirebaseApp> _firebaseDefaultApp = Firebase.initializeApp();

List<FirebaseApp> apps = Firebase.apps;
_firebaseSecondaryApp = Firebase.initializeApp(name: "SecondaryApp", options: apps[0].options);

Upvotes: 0

Abdulhakim
Abdulhakim

Reputation: 795

I know I'm already late here, but this could be caused by improper configuration from Google Map or other API keys from within iOS. Try running the app in Xcode and you will get a more helpful error message.

In my case, it was a Google Map API key missing.

Solution:

Open AppDelegate.swift Add import GoogleMaps along with the other imports Add the following statement above GeneratedPluginRegistrant.register(with: self): GMSServices.provideAPIKey("YOUR_API_KEY_HERE") where YOUR_API_KEY would be something like AIzaSyBHV....wZEIg from the Cloud Console.

Upvotes: 1

Taym95
Taym95

Reputation: 2510

You are using Firebase and you probably forgot to add firebase's GoogleService-Info.plist file to your IOS project from xcode.

Also sometimes you need to run pod install inside IOS project to install the required pods.

Upvotes: 2

Related Questions