3

I'm building a flutter mobile application with firebase_auth to authenticate. It's run well on android. But when i'm try to build it on ios using xcode it gives me series of erros.

I have added the GoogleService-info.plist file inside Runner folder using xcode and added the Firebase.configure() code potion in AppDeligate.swift file. But still not working for me.

enter image description here

dilusha_dasanayaka
  • 1,401
  • 2
  • 17
  • 30
  • try this: `cd ios` and `pod update`. – Akif Sep 01 '21 at 11:59
  • tried it. not working. same error – dilusha_dasanayaka Sep 01 '21 at 16:59
  • You can contact me via linkedin. Visit my profile. I think we need to look project together. – Akif Sep 01 '21 at 20:14
  • Can you show the file navigator? I don't see the pods project which may mean that the pods need to be regenerated. See my answer for this and other possible issues related to these errors. Basically Xcode doesn't recognize the pods correctly. Could also happen if the google info file is not recognized... – Tommie C. Sep 04 '21 at 18:47

3 Answers3

3

Actually if you are develop your iOS app with Flutter you cant build in Xcode. You have to build with Flutter.

flutter clean
flutter build ios

Then

Xcode -> Product -> Destination -> Any iOS Device

Xcode-> Product -> Scheme -> choose scheme -> Runner

Xcode-> Product -> Archive

Or

flutter clean
flutter build ipa

then

Xcode-> Product -> Archive
guccisekspir
  • 1,359
  • 1
  • 9
  • 29
  • 1
    `if you are develop your iOS app with Flutter you cant build in Xcode`. **Not true**, you can build with Xcode, I do it all the time so I can debug the iOS code. – Ben Butterworth Aug 31 '21 at 06:01
2

Running in Xcode

First make sure to run pod install in the ios directory: cd ios; pod install

Then in Xcode, clean (Command + Shift + K) & rebuild (Command + B).

Running using flutter cli

Flutter CLI will make sure to run pod install for you. So it should work just by runnning flutter run or flutter build

Ben Butterworth
  • 22,056
  • 10
  • 114
  • 167
  • I have run flutter run but it lead me to an error. Failed to build iOS app Error output from Xcode build: ↳ objc[3751]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1eecf3ad8) do you have any idea? – dilusha_dasanayaka Sep 01 '21 at 07:50
  • Did you try cleaning/ rebuilding in Xcode? – Ben Butterworth Sep 02 '21 at 05:59
0

Xcode errors almost never have singular answers

Add the GoogleService-info.plist file into your Xcode project by right-clicking on any file inside the Runner folder within the file Navigator pane (select add files to project and then add the GoogleService-info.plist into the project). This process will make sure that the Xcode project sees the file.

Make sure you enable the internet permission in the project.

You can install and use the pod deintegrate tool (src); with that tool you will be able to easily reset your Pod environment. A Google search can also give you others ways to reset the cocoapod environment. After which you'd want to pod install to ensure you get the latest versions of everything.

Make sure you address the pod warnings that usually appear. They might ask you to change your debug configuration to the Pods.debug reference for example.

flutter build ios will create any flutter specific files that might be missing so running this command in terminal from your project root folder is a great idea.

Another often missed opportunity is to just go into your root project and dump the (ios, macos, android, etc.) folder completely. Then use flutter create . from the project root folder to recreate the iOS folder before running flutter build then doing the normal sequence of getting Xcode ready.

In Xcode:

  • Open the workspace file not the Project file (we should see both Runner and Pods in the screenshot provided and I don't see that in yours)
  • Ensure that the project is signed
  • On the Runner project change the debug configurations to the Pods.
  • Add the Google info file into the iOS folder
  • Add the Google info file into the project workspace from within Xcode

NOTE:

I expect to see the Pods Project when you open the Runner.xcworkspace file. If not, make sure you are opening the workspace file, close Xcode and regenerate the pods from the iOS folder using pod install or from the root folder run flutter build ios.

Pods Project

Tommie C.
  • 12,895
  • 5
  • 82
  • 100