10
votes

I get this error when I try running.

Launching lib/main.dart on iPhone XR in debug mode...
Starting Xcode build...

Xcode build done.                                           35.9s

*** First throw call stack:

(

0   CoreFoundation                      0x00000001099ff1bb __exceptionPreprocess + 331

1   libobjc.A.dylib                     0x0000000108f9d735 objc_exception_throw + 48

2   CoreFoundation                      0x00000001099ff015 +[NSException raise:format:] + 197

3   Runner                              0x00000001040a8aa0 +[FIRApp configure] + 576

4   Runner                              0x00000001044a931c -[FLTCloudFirestorePlugin init] + 188

5   Runner                              0x00000001044a91c9 +[FLTCloudFirestorePlugin registerWithRegistrar:] + 297

6   Runner                              0x000000010404d19e +[GeneratedPluginRegistrant registerWithRegistry:] + 126

7   Runner                        <…>

[✓] Flutter (Channel dev, v1.1.5, on Mac OS X 10.14.2 18C54, locale en-NG)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)

[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)

[✓] Android Studio (version 3.2)

[✓] IntelliJ IDEA Ultimate Edition (version 2018.1.6)

[✓] Connected device (1 available)

• No issues found!

3
how is your ios/Runner folder ? did you put info.list ?Rubens Melo
You mean info.plist?? Yes. no info.list thoOga Emma

3 Answers

24
votes

I guess you forgot to add GoogleService-Info.plist file to your ios project

Follow this codelab (point 6 and 7 specifically) for detailed instruction.

Remember that it's not enough to copy it in your ios/Runner folder from the finder/explorer or command line.

You need to open the ios/Runner.xcworkspace with Xcode and add the file to the project tree. Xcode needs to be aware of this file, so that it can be copied in the application bundle.

3
votes

For cases with two google-services plist files you can add a new build phase to copy the file to the correct location on compilation.

  1. Create a config folder on the root of the iOS folder and inside it have the names of the two apps/builds you're targeting. Add the files accordingly to the folders. Next, head to Target Runner and on the Build Phases section.
  2. Add a new run script phase by clicking the + button at the top of that section.
  3. Rename it to a descriptive title, I call mine Copy GoogleServices-Info.plist to correct location Then move it right below the Link Binary With Libraries phase.
  4. Copy the following script into the build phase body
environment="default"
# Regex to extract the scheme name from the Build Configuration
# We have named our Build Configurations as Debug-dev, Debug-prod etc.
# Here, dev and prod are the scheme names. This kind of naming is required by Flutter for flavors to work.
# We are using the $CONFIGURATION variable available in the XCode build environment to extract 
# the environment (or flavor)
# For eg.
# If CONFIGURATION="Debug-prod", then environment will get set to "prod".
if [[ $CONFIGURATION =~ -([^-]*)$ ]]; then
environment=${BASH_REMATCH[1]}
fi

echo $environment

# Name and path of the resource we're copying
GOOGLESERVICE_INFO_PLIST=GoogleService-Info.plist
GOOGLESERVICE_INFO_FILE=${PROJECT_DIR}/config/${environment}/${GOOGLESERVICE_INFO_PLIST}

# Make sure GoogleService-Info.plist exists
echo "Looking for ${GOOGLESERVICE_INFO_PLIST} in ${GOOGLESERVICE_INFO_FILE}"
if [ ! -f $GOOGLESERVICE_INFO_FILE ]
then
echo "No GoogleService-Info.plist found. Please ensure it's in the proper directory."
exit 1
fi

# Get a reference to the destination location for the GoogleService-Info.plist
# This is the default location where Firebase init code expects to find GoogleServices-Info.plist file
PLIST_DESTINATION=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app
echo "Will copy ${GOOGLESERVICE_INFO_PLIST} to final destination: ${PLIST_DESTINATION}"

# Copy over the prod GoogleService-Info.plist for Release builds
cp "${GOOGLESERVICE_INFO_FILE}" "${PLIST_DESTINATION}"

Try running the app and it should be good

0
votes

If you're developing your Flutter app for both iOS and Android, you need to register both the iOS and Android versions separately within the same Firebase project.

Configure iOS

  1. In the Firebase console, select Project Overview in the left nav, then click the iOS button under "Get started by adding Firebase to your app".

enter image description here

  1. The important value to provide is the iOS bundle ID, which you'll obtain using the following three steps.

  2. In the command line tool, go to the top-level directory of your Flutter app.

  3. Run the command open ios/Runner.xcworkspace to open Xcode (Go > ios/Runner.xcworkspace and click right and select Flutter > click on Open iOS module in Xcode)

  4. In Xcode, click the top-level Runner in the left pane to show the General tab in the right pane, as shown in the screencap below. Copy the Bundle Identifier value. enter image description here

  5. Back in the Firebase dialog, paste the copied Bundle Identifier into the iOS bundle ID field, then click Register App.

  6. Continuing in Firebase, follow the instructions to download the config file GoogleService-Info.plist.

  7. Go back to Xcode. Notice that Runner has a subfolder also called Runner (as shown in the screencap above).

  8. Drag the GoogleService-Info.plist file (that you just downloaded) into that Runner subfolder.

  9. In the dialog that appears in Xcode, click Finish.

  10. Go back to the Firebase console. In the setup step, click Next, then skip the remaining steps and go back to the main page of the Firebase console.

You're done configuring your Flutter app for iOS!

For More : Platform-specific Firebase configuration