以firebase引起的NSException类型的未捕获异常终止



在IOS上运行应用程序时,我遇到了一个问题,只是应用程序从一开始就崩溃了。该应用程序在Android上运行,但在IOS上不运行我在运行带有两个插件的应用程序时遇到了一些问题,智能外观和flutter freshchat,但我可以通过删除pod文件并将flutter fresh chat文件夹作为公共来处理这些错误

我正在寻找许多解决方案,但没有解决问题

我使用了Xcode 11.6

错误

2020-08-04 09:28:31.629532+0300 Runner[55327:357948] 6.29.0 - [Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
2020-08-04 09:28:31.673649+0300 Runner[55327:357998] flutter: Observatory listening on http://127.0.0.1:61149/gGQPi_bDYqA=/
2020-08-04 09:28:31.825074+0300 Runner[55327:357355] *** Terminating app due to uncaught exception 'com.firebase.core', reason: '`[FIRApp configure];` (`FirebaseApp.configure()` in Swift) could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com/.'
*** First throw call stack:
(
0   CoreFoundation                      0x00007fff23e3de6e __exceptionPreprocess + 350
1   libobjc.A.dylib                     0x00007fff512539b2 objc_exception_throw + 48
2   CoreFoundation                      0x00007fff23e3dcac +[NSException raise:format:] + 188
3   Runner                              0x00000001021a5e92 +[FIRApp configure] + 130
4   Runner                              0x000000010201439b $s6Runner11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtF + 251
5   Runner                              0x0000000102014723 $s6Runner11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtFTo + 211
6   UIKitCore                           0x00007fff4931c614 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 232
7   UIKitCore                           0x00007fff4931dfb3 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 3985
8   UIKitCore                           0x00007fff49323b75 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1226
9   UIKitCore                           0x00007fff48a2c16d -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
10  UIKitCore                           0x00007fff48f37ba1 _UIScenePerformActionsWithLifecycleActionMask + 83
11  UIKitCore                           0x00007fff48a2cc7f __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198
12  UIKitCore                           0x00007fff48a2c68e -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 296
13  UIKitCore                           0x00007fff48a2caac -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 818
14  UIKitCore                           0x00007fff48a2c341 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 345
15  UIKitCore                           0x00007fff48a30932 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke_2 + 178
16  UIKitCore                           0x00007fff48e4dc8d +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 852
17  UIKitCore                           0x00007fff48f562fe _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 240
18  UIKitCore                           0x00007fff48a3064d __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 153
19  UIKitCore                           0x00007fff48f56201 _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 84
20  UIKitCore                           0x00007fff48a304bb -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 381
21  UIKitCore                           0x00007fff48884eb8 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 657
22  UIKitCore                           0x00007fff48883a77 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 253
23  UIKitCore                           0x00007fff48884be2 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 210
24  UIKitCore                           0x00007fff493220bd -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 512
25  UIKitCore                           0x00007fff48e747bc -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
26  FrontBoardServices                  0x00007fff36d37d2e -[FBSSceneImpl _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 419
27  FrontBoardServices                  0x00007fff36d5ddc1 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke.154 + 102
28  FrontBoardServices                  0x00007fff36d42757 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 220
29  FrontBoardServices                  0x00007fff36d5da52 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke + 355
30  libdispatch.dylib                   0x000000010744ae8e _dispatch_client_callout + 8
31  libdispatch.dylib                   0x000000010744dda2 _dispatch_block_invoke_direct + 300
32  FrontBoardServices                  0x00007fff36d836e9 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
33  FrontBoardServices                  0x00007fff36d833d7 -[FBSSerialQueue _queue_performNextIfPossible] + 441
34  FrontBoardServices                  0x00007fff36d838e6 -[FBSSerialQueue _performNextFromRunLoopSource] + 22
35  CoreFoundation                      0x00007fff23da1c91 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
36  CoreFoundation                      0x00007fff23da1bbc __CFRunLoopDoSource0 + 76
37  CoreFoundation                      0x00007fff23da1394 __CFRunLoopDoSources0 + 180
38  CoreFoundation                      0x00007fff23d9bf8e __CFRunLoopRun + 974
39  CoreFoundation                      0x00007fff23d9b8a4 CFRunLoopRunSpecific + 404
40  GraphicsServices                    0x00007fff38c39bbe GSEventRunModal + 139
41  UIKitCore                           0x00007fff49325968 UIApplicationMain + 1605
42  Runner                              0x00000001020148cb main + 75
43  libdyld.dylib                       0x00007fff520ce1fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

我在应用程序上使用的depancies:

scoped_model: ^1.0.1
http: ^0.12.2
shared_preferences: ^0.5.6+3
intl: ^0.16.0
sliding_up_panel: ^0.3.4 
carousel_slider: ^2.1.0
flutter_calendar_carousel: any
keyboard_avoider: ^0.1.2
mobile_popup: ^1.2.0
easy_listview: ^0.1.3
sqflite: ^1.2.2+1
crclib: ^1.0.1
firebase_core: ^0.4.5
firebase_auth: ^0.16.1
cloud_firestore: ^0.13.7
flutter_html: ^0.11.1
flutter_material_color_picker: ^1.0.3
auto_size_text: ^2.1.0
# loadmore: ^1.0.4
sticky_headers: "^0.1.8"
webview_flutter: ^0.3.19+9
connectivity: ^0.4.9
expandable: ^4.1.3
path_provider: ^1.6.11
url_launcher: ^5.2.7
# flutter_typeahead: ^1.8.0
find_dropdown: ^0.2.0
geolocator: ^5.1.4+2
google_maps_flutter: ^0.5.21+8
location: ^2.3.5
permission_handler: ^5.0.1+1
loading_indicator: ^1.1.0
# localstorage: ^2.0.0
photo_view: ^0.9.0
maps_launcher: ^1.0.1 
flutter_offline: "^0.3.0"
# fluttertoast: ^7.0.1+1
google_maps_webservice: ^0.0.16
flutter_google_places: ^0.2.3
flutter_datetime_picker: ^1.3.1
flutter_date_pickers: ^0.0.6
circular_bottom_navigation: ^1.0.1
progress_dialog: ^1.2.0
flutter_fluid_slider: ^1.0.2
lazy_load_scrollview: ^1.1.0
holding_gesture: ^0.0.3
firebase_remote_config: ^0.3.1+1
cached_network_image: ^2.0.0
rxdart: ^0.23.0
package_info: ^0.4.0+13
firebase_analytics: ^5.0.16
dio: ^3.0.9
duration: ^2.0.11 
flutter_freshchat: ^1.3.2
firebase_messaging: ^6.0.16
firebase_dynamic_links: ^0.5.3
share: ^0.6.4+1
firebase_crashlytics: ^0.1.4+1
smartlook: ^1.0.1
search_map_place: ^0.1.1
dio_http_cache: ^0.2.6
flutter_staggered_animations: ^0.1.2
shimmer: ^1.1.1
flutter_progress_button: ^1.0.0
flutter_inappwebview: ^4.0.0+4
device_info: ^0.4.2+4

显示错误的AppDelgate.swift

import UIKit
import Flutter
import GoogleMaps
import Firebase

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {

GMSServices.provideAPIKey("AIzaSyBdi_rTaOCYcqtx1xCdChTg5-pol9EQHfo")
FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

}

Flutter Doctor结果

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.4 19E287, locale en-BH)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.47.3)
[✓] Connected device (2 available)
• No issues found!

错误很明显:

reason: '`[FIRApp configure];` (`FirebaseApp.configure()` in Swift) 
could not find a valid GoogleService-Info.plist in your project. 
Please download one from https://console.firebase.google.com/.'

你的项目中没有Google.plist文件。

--->您需要获取GoogleService-Info.plist文件并将其添加到您的项目中。

您缺少一个GoogleService-Info.plist,您说您确实有它,但如果它的名称不是"GoogleServiceInfo.plist",应用程序就会崩溃,就像您得到的一样。例如,您的"GoogleService Info.plist"可能被命名为"GoogleService Info(1(.plist",因为您可能有2个同名文件,或者您在查找器中意外删除了您的GoogleService-Info.plist。如果您将"GoogleService Info.plist"移动到其他文件夹(如从下载文件夹移动到桌面(,也会导致问题。

如果这些都不起作用,那么应用程序或其他与之相关的东西可能会出现错误。

相关内容

最新更新