简体   繁体   中英

How to integrate Firebase Crashlytics for iOS part of Flutter app?

I am trying to integrate firebase_crashlytics in my Flutter App. https://pub.dartlang.org/packages/firebase_crashlytics#-readme-tab- I am facing an issue with iOS integration. In the docs, it is specified that If on Xcode 10 Add your app's built Info.plist location to the Build Phase's Input Files field. Eg: $(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH) If on Xcode 10 Add your app's built Info.plist location to the Build Phase's Input Files field. Eg: $(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)

I have already created the Firebase project and did the initial setup required on the iOS part like pod install for Firebase and adding code in AppDelegate File.

I am not able to figure out what does this means? does it mean the literal path of info.plist file. I downloaded the sample project mentioned in the docs but it does not have anything related to the above point. I did something as below在此处输入图片说明

I literally added the path to my info.plist file as below $(BUILT_PRODUCTS_DIR)/$(/Users/priitshsawant/Desktop/firebase_crashltics/firebase_crashltics/ios/Runner/Info.plist) . I tried crashing my app but it is not showing up in Firebase Crashlytics

You should be perfectly fine by just leaving it as $(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)
This will resolve to your absolute path of the Info.plist once Xcode is building.

Just like so:

在此处输入图片说明

I fixed this problem following these steps.

  1. Make sure that Run Script is added as mention by the Robin Reiter
  2. Run Flutter Clean
  3. Run Pod install
  4. Then use Xcode to build and run
  5. if it's not working with the actual device use the simulator

You can implement like this way

  1. From Xcode select Runner from the project navigation.
  2. Select the Build Phases tab, then click + > New Run Script Phase.
  3. Add ${PODS_ROOT}/FirebaseCrashlytics/run to the Type a script... text box .
  4. Optionally you can also provide your app's built Info.plist location to the build phase's Input Files field: For example: $(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)

Add the run script as per the below image

在此处输入图片说明

  1. Once complete, rebuild your Flutter application:

     flutter run

If you are migrating from a previous version of Crashlytics that used Fabric, please follow these guides and remove any legacy Fabric integration steps from your project:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM