Search code examples
iosswiftflutterxcodefirebase

Swift Compiler Error (Xcode): Cannot assign value of type '(any AuthInterop)?' to type 'any AuthInterop'


Problem Keywords: Firebase, Flutter, and iOS.

While I encounter no issues with the Android part, I have been unable to successfully build for iOS. Below are the error codes I am experiencing.

Flutter version: 3.22.3 Stable

XCode: 15.4 (latest version at the time of release)

"flutter doctor" results: All checks are green.

The issue arises when running the flutter build ios command.

When using version 10.22.0 of the firebase-ios-sdk package:

Uncategorized (Xcode): Could not resolve package dependencies:
  file not found at path:
  /Users/username/Library/Developer/Xcode/DerivedData/Runner-dzholwmcosvbzjckrwbsnmmxsodb/SourcePackages/artifacts/firebase-ios-sdk/FirebaseAnalytics/FirebaseAnalytics-rc1.
  zip
  fatalError

When using version 11.0.0 of the firebase-ios-sdk package:

Swift Compiler Error (Xcode): Value of optional type '(any StorageProvider)?' must be unwrapped to refer to member 'storage' of wrapped base type 'any StorageProvider'
/Users/username/Desktop/project/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/Storage.swift:72:11


Swift Compiler Error (Xcode): Value of optional type '(any StorageProvider)?' must be unwrapped to refer to member 'storage' of wrapped base type 'any StorageProvider'
/Users/username/Desktop/project/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/Storage.swift:87:11


Swift Compiler Error (Xcode): Cannot assign value of type '(any AuthInterop)?' to type 'any AuthInterop'
/Users/username/Desktop/project/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/Storage.swift:290:38


Swift Compiler Error (Xcode): Cannot assign value of type '(any AppCheckInterop)?' to type 'any AppCheckInterop'
/Users/username/Desktop/project/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/Storage.swift:292:46

Thank you in advance for any assistance you can provide!

Steps I Have Taken to Resolve the Issue:

  • Uninstalling and reinstalling XCode.
  • Trying different versions of XCode.
  • Testing different versions of the Firebase iOS SDK package.
  • Using CocoaPods instead of XCode for package installation.

Solution

  • Its ok. The reason for this error is that I included firebase packages with any package manager for ios while integrating firebase into the project in the flutter application. When it comes to flutter, a package should not be included. Applying firebase documentation is wrong, FlutterFire documentation should be applied completely and without any excess. As some people say, do not try to learn swift and interfere with these codes, these are not your codes, they are located in the root directory of firebase packages.