NativeScript / firebase

Modular Firebase 🔥 implementation for NativeScript. Supports both iOS & Android platforms for all Firebase services.
https://docs.nativescript.org/plugins/firebase-core.html
Apache License 2.0
56 stars 50 forks source link

iOS build fails with "value of optional type ... must be unwrapped" error #247

Closed hendrickson-tyler closed 8 months ago

hendrickson-tyler commented 8 months ago

Been facing some issues with my iOS builds using the Firebase plugins recently. I'm not sure if this is related to an Xcode update or what, but xcodebuild fails with the following error for each of the plugins I'm using:

/Users/tylerhendrickson/Developer/actions-runner/_work/my-app/my-app/apps/mobile/platforms/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/Storage.swift:73:12: 
error: value of optional type '(any StorageProvider)?' must be unwrapped to refer to member 'storage' of wrapped base type 'any StorageProvider'
    return provider.storage(for: Storage.bucket(for: app))
           ^

It looks like this error was also experienced in React Native and Flutter, but is fixed by updating to use v10.22.0+ of the SDKs. I can confirm that this fixes the issue as patching each of the plugins in my project fixes the build:

diff --git a/node_modules/@nativescript/firebase-auth/platforms/android/firebase_auth.aar b/node_modules/@nativescript/firebase-auth/platforms/android/firebase_auth.aar
index d9a8772..06e7107 100644
Binary files a/node_modules/@nativescript/firebase-auth/platforms/android/firebase_auth.aar and b/node_modules/@nativescript/firebase-auth/platforms/android/firebase_auth.aar differ
diff --git a/node_modules/@nativescript/firebase-auth/platforms/ios/Podfile b/node_modules/@nativescript/firebase-auth/platforms/ios/Podfile
index ed41821..c419be6 100644
--- a/node_modules/@nativescript/firebase-auth/platforms/ios/Podfile
+++ b/node_modules/@nativescript/firebase-auth/platforms/ios/Podfile
@@ -1,2 +1,2 @@
 platform :ios, '12.0'
-pod 'Firebase/Auth', '~>10.20.0'
\ No newline at end of file
+pod 'Firebase/Auth', '~>10.22.0'

I've created a quick PR on this for consideration.