Dhruvbhati
Dhruvbhati

Reputation: 307

Flutter app always crashes on run in ios emulator

I am trying to open a flutter app . whenever trying to open the app , it shows white screen for 1-2 seconds and app is closed . I am trying to open it through terminal by flutter run . Heres the log of the terminal :

Launching lib/main.dart on iPhone 8 in debug mode...

Running pod install...                                              4.2s
Running Xcode build...                                                  

 ├─Assembling Flutter resources...                          20.9s
 └─Compiling, linking and signing...                        24.6s
Xcode build done.                                           91.3s
    path: satisfied (Path is satisfied), interface: en0
Configuring the default Firebase app...
    path: satisfied (Path is satisfied), interface: en0
Configured the default Firebase app __FIRAPP_DEFAULT.
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
    path: satisfied (Path is satisfied), interface: en0
    path: satisfied (Path is satisfied), interface: en0
flutter: getCurrentLocation                                             
flutter: getCurrentLocation                                             
Syncing files to device iPhone 8...                                     
*** First throw call stack:                                     
(                                                                                       0   CoreFoundation                      0x00007fff23b98bde __exceptionPreprocess + 350                     
        1   libobjc.A.dylib                     0x00007fff503b5b20 objc_exception_throw + 48                       
        2   CoreFoundation                      0x00007fff23b98a1c +[NSException raise:format:] + 188              
        3   location                            0x000000010ea6688c -[LocationPlugin requestPermission] + 460       
        4   location                            0x000000010ea65f0a -[LocationPlugin handleMethodCall:result:] + 1946
        5   Flutter                             0x000000010c816b35 __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 104
        6   Flutter                             0x000000010c7aa920 _ZNK7flutter21PlatformMessageRouter21HandlePlatformMess<…>
Lost connection to device.  

I have tried flutter clean , flutter pub get and all many times . Can anyone help me with this error , i am completly new to flutter and xcode . Also tell me if want to have a look at other files to solve this . i will paste them here . I have runned flutter doctor and no issues there . Thanks

UPDATE info.plist file :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>$(DEVELOPMENT_LANGUAGE)</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>restaurant_rlutter_ui</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$(FLUTTER_BUILD_NAME)</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>$(FLUTTER_BUILD_NUMBER)</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
</dict>
</plist>

Upvotes: 3

Views: 1675

Answers (1)

Shubham Gupta
Shubham Gupta

Reputation: 2007

You are missing location permission in the info.plist file. Add the following line to your info.plist

<key>NSLocationAlwaysUsageDescription</key>
<string>some description</string> 
<key>NSLocationWhenInUseUsageDescription</key>
<string>some description</string>

Upvotes: 4

Related Questions