firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.67k stars 1.49k forks source link

Unable to Connect to Firestore on iOS 18 devices. #13668

Closed MagicFlow29 closed 1 month ago

MagicFlow29 commented 1 month ago

Description

App cannot connect to Firestore or other services after building to an iOS 18 target.

App does connect when deploying to iOS17.5 device.

Existing app (from app store) still connects.

This is experienced only on new builds to iOS 18 devices. The issue DOES NOT occur when deploying to an iOS 17.5 device / simulator.

11.2.0 - [FirebaseFirestore][I-FST000001] Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds. This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.

Reproducing the issue

Upgrade device / xcode to latest. XCODE: Version 16.0 (16A242d) DEVICE: iOS 18.0

Build app - attempt to query firestore.

Firebase SDK Version

11.20

Xcode Version

16.0

Installation Method

Swift Package Manager

Firebase Product(s)

Firestore

Targeted Platforms

iOS

Relevant Log Output

11.2.0 - [FirebaseFirestore][I-FST000001] Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
 This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
```json Replace this line with the contents of your Package.resolved. ```

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
```yml Replace this line with the contents of your Podfile.lock! ```
google-oss-bot commented 1 month ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

cherylEnkidu commented 1 month ago

Hi @MagicFlow29 ,

I tested iOS 18 on Xcode simulator with latest version of Xcode and Firebase SDK. The app connects to backend successfully. Could you please upgrade the Xcode and SDK, and check the Internet connection on your device or/and simulator? Please let me know if you are still running into problems.

MagicFlow29 commented 1 month ago

Hi and thankyou for your response. Both XCODE and the SDK were / have been updated to the latest. The internet connection is available also. Please note, a build to a 17.5 device on the same code base work perfectly fine. I'm not sure what else to try. This is a production app, and the same code base simply won't connect to Firestore or any other services on iOS 18.0 devices.

App Check was configured but not enforced on the server side... so this isn't it either.

cherylEnkidu commented 1 month ago

Hi @MagicFlow29 ,

Could you please enable debug logging and share it with us? Also can you create a simple repo app to see if the problem also exists in the new app?

MagicFlow29 commented 1 month ago

Hi and thankyou @cherylEnkidu please see logs below. *In the process of creating a fresh / new app to compare.

1.2.0 - [FirebaseCore][I-COR000001] Configuring the default app. 11.2.0 - [FirebaseCore][I-COR000033] Data Collection flag is not set. 11.2.0 - [FirebaseInstallations][I-FIS002000] -[FIRInstallationsIDController createGetInstallationItemPromise], appName: __FIRAPP_DEFAULT 11.2.0 - [FirebaseAnalytics][I-ACS024000] Debug mode is on 11.2.0 - [GULReachability][I-REA902003] Monitoring the network status 11.2.0 - [FirebaseAnalytics][I-ACS023007] Analytics v.11.2.0 started 11.2.0 - [FirebaseAnalytics][I-ACS023008] To disable debug logging set the following application argument: -noFIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r) 11.2.0 - [FirebaseAnalytics][I-ACS023009] Debug logging enabled 11.2.0 - [FirebaseAnalytics][I-ACS023207] To enable verbose logging set the following application argument: -FIRAnalyticsVerboseLoggingEnabled (see http://goo.gl/RfcP7r) 11.2.0 - [GULReachability][I-REA902003] Monitoring the network status 11.2.0 - [FirebaseAnalytics][I-ACS044003] GoogleAppMeasurementIdentitySupport dependency is not currently linked. IDFA will not be accessible. 11.2.0 - [FirebaseAnalytics][I-ACS002002] APMExperimentAlarm scheduled to fire in approx. (s): 9.999984979629517 11.2.0 - [FirebaseAnalytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement 11.2.0 - [FirebaseAnalytics][I-ACS029017] Configuration was not found in database. The configuration will be fetched from the network when necessary 11.2.0 - [FirebaseAnalytics][I-ACS023016] Analytics is ready to receive events 11.2.0 - [FirebaseAnalytics][I-ACS023087] User property set. Name, value: ga_session_id (_sid), 1726774216 11.2.0 - [FirebaseAnalytics][I-ACS023087] User property set. Name, value: ga_session_number (_sno), 6 11.2.0 - [FirebaseAnalytics][I-ACS023051] Logging event: origin, name, params: auto, session_start (_s), { ga_event_origin (_o) = auto; session_id (_sid) = 1726774216; session_number (_sno) = 6; } 11.2.0 - [FirebaseAnalytics][I-ACS023073] Debug mode is enabled. Marking event as debug and real-time. Event name, parameters: session_start (_s), { ga_debug (_dbg) = 1; ga_event_origin (_o) = auto; ga_realtime (_r) = 1; session_id (_sid) = 1726774216; session_number (_sno) = 6; } 11.2.0 - [FirebaseMessaging][I-FCM043000] Info is not found in Keychain. OSStatus: -25300. Keychain query: { acct = ""; class = genp; gena = "com.google.iid"; "m_Limit" = "m_LimitAll"; nleg = 1; "r_Attributes" = 1; "r_Data" = 1; svce = "com.google.iid.checkin"; } 11.2.0 - [FirebaseMessaging][I-FCM033009] App reset detected but no valid checkin auth preferences found. Will not delete server token registrations. 11.2.0 - [FirebaseMessaging][I-FCM002000] FIRMessaging library version 11.2.0 11.2.0 - [GULReachability][I-REA902003] Monitoring the network status 11.2.0 - [FirebaseMessaging][I-FCM043000] Info is not found in Keychain. OSStatus: -25300. Keychain query: { acct = ""; class = genp; gena = "com.google.iid-tokens"; "m_Limit" = "m_LimitAll"; nleg = 1; "r_Attributes" = 1; "r_Data" = 1; svce = "1092436558056:*"; } 11.2.0 - [FirebaseMessaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at: https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging to ensure proper integration. 11.2.0 - [GoogleUtilities/AppDelegateSwizzler][I-SWZ001014] App Delegate does not conform to UIApplicationDelegate protocol. [Firebase/Crashlytics] Version 11.2.0 11.2.0 - [FirebaseSessions][I-SES000000] Version 11.2.0. Expecting subscriptions from: [Performance, Crashlytics] 11.2.0 - [FirebaseCrashlytics][I-CLS000000] [Crashlytics] Running on iOS Simulator (iPhone), 18.0.0 (24A335) 11.2.0 - [FirebaseCrashlytics][I-CLS000000] Registering Sessions SDK subscription for session data 11.2.0 - [FirebaseSessions][I-SES000000] Registering Sessions SDK subscriber with name: Crashlytics, data collection enabled: true 11.2.0 - [FirebaseCrashlytics][I-CLS000000] Session ID changed: 7b74c38222eb4762aec5985fc7cbace0 11.2.0 - [FirebaseCrashlytics][I-CLS000000] Root: /Users/simoncanil/Library/Developer/CoreSimulator/Devices/7E91C279-26DB-461A-A0E9-105AF04A496A/data/Containers/Data/Application/5CDFA059-A572-4B71-9926-DCBC19F0E8F5/Library/Caches/com.crashlytics.data/ 11.2.0 - [FirebaseCrashlytics][I-CLS000000] [Crashlytics:Crash] Last launch failed: this may indicate a crash shortly after app launch. 11.2.0 - [FirebaseCrashlytics][I-CLS000000] [Crashlytics:Crash:Reports:Event] Registered Firebase Analytics event listener to receive breadcrumb logs 11.2.0 - [FirebaseCrashlytics][I-CLS000000] Automatic data collection is enabled. 11.2.0 - [FirebaseCrashlytics][I-CLS000000] Unsent reports will be uploaded at startup 11.2.0 - [FirebaseCrashlytics][I-CLS000000] Registering RemoteConfig SDK subscription for rollouts data

[AppCheckCore][I-GAC004001] App Check debug token: '64687330-F98A-4E83-8A35-16752CF3A93F'. Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.} Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.} Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.} Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.} Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.} Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.} 11.2.0 - [FirebaseRemoteConfig][I-RCN000062] Loading database at path /Users/simoncanil/Library/Developer/CoreSimulator/Devices/7E91C279-26DB-461A-A0E9-105AF04A496A/data/Containers/Data/Application/5CDFA059-A572-4B71-9926-DCBC19F0E8F5/Library/Application Support/Google/RemoteConfig/RemoteConfig.sqlite3 11.2.0 - [FirebaseAppCheck][I-FAA005001] Firebase App Check debug token: '64687330-F98A-4E83-8A35-16752CF3A93F'. 11.2.0 - [FirebaseInAppMessaging][I-IAM170002] Auto bootstrap Firebase in-app messaging SDK 11.2.0 - [FirebaseInAppMessaging][I-IAM170004] Running in simulator. Do realtime clearcut uploading. 11.2.0 - [FirebaseInAppMessaging][I-IAM310001] Persistent file path for activity log data is /Users//Library/Developer/CoreSimulator/Devices/7E91C279-26DB-461A-A0E9-105AF04A496A/data/Containers/Data/Application/5CDFA059-A572-4B71-9926-DCBC19F0E8F5/Library/Caches/firebase-iam-activity-log-cache Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.} Updating selectors after delegate addition failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.} 11.2.0 - [FirebasePerformance][I-PRF100001] Firebase Performance Monitoring is successfully initialized! In a minute, visit the Firebase console to view your data: https://console.firebase.google.com/project//performance/app/ios:/trends?utm_source=perf-ios-sdk&utm_medium=ios-ide 11.2.0 - [FirebasePerformance][I-PRF100001] Registering Sessions SDK subscription for session data 11.2.0 - [FirebaseSessions][I-SES000000] Registering Sessions SDK subscriber with name: Performance, data collection enabled: true 11.2.0 - [FirebasePerformance][I-PRF900002] Session Id changed - 7b74c38222eb4762aec5985fc7cbace0 11.2.0 - [FirebaseInAppMessagingDisplay][I-FID100010] Got notification for kFIRAppReadyToConfigureSDKNotification. Setting display component on headless SDK. 11.2.0 - [FirebaseInAppMessaging][I-IAM290001] Setting a non-nil message display component 11.2.0 - [FirebaseInAppMessaging][I-IAM230001] Persistent file path for clearcut log records is /Users/simoncanil/Library/Developer/CoreSimulator/Devices/7E91C279-26DB-461A-A0E9-105AF04A496A/data/Containers/Data/Application/5CDFA059-A572-4B71-9926-DCBC19F0E8F5/Library/Caches/firebase-iam-clearcut-retry-records 11.2.0 - [FirebaseInAppMessaging][I-IAM230005] Returning 0 clearcut retry records from popStillValidRecords 11.2.0 - [FirebaseInAppMessaging][I-IAM260001] FIRIAMClearcutUploader created with strategy as min wait time in seconds:0;max wait time in seconds:0;failure backoff time in seconds:3600;batch send size:50 11.2.0 - [FirebaseInAppMessaging][I-IAM290001] SDK is in mode of Newly Installed and has seen 0 fetches. 11.2.0 - [FirebaseInAppMessaging][I-IAM300010] Detected 2 custom URL schemes from environment We have a failure The operation couldn’t be completed. (ImageConversionError error 0.) 11.2.0 - [FirebaseRemoteConfig][I-RCN000067] Successfully set configSettings. Minimum Fetch Interval:43200.000000, Fetch timeout:60.000000 11.2.0 - [FirebaseRemoteConfig][I-RCN000039] Starting requesting token. 11.2.0 - [FirebaseRemoteConfig][I-RCN000039] Starting requesting token. 11.2.0 - [FirebaseInstallations][I-FIS002001] -[FIRInstallationsIDController installationWithValidAuthTokenForcingRefresh:0], appName: __FIRAPP_DEFAULT 11.2.0 - [GULReachability][I-REA902004] Network status has changed. Code:2, status:Connected 11.2.0 - [GULReachability][I-REA902004] Network status has changed. Code:2, status:Connected 11.2.0 - [GULReachability][I-REA902004] Network status has changed. Code:2, status:Connected 11.2.0 - [FirebaseAuth][I-AUT000002] Token auto-refresh enabled. 11.2.0 - [GoogleUtilities/SceneDelegateSwizzler][I-SWZ001114] Successfully created Scene Delegate Proxy automatically. To disable the proxy, set the flag GoogleUtilitiesAppDelegateProxyEnabled to NO (Boolean) in the Info.plist 11.2.0 - [FirebaseInAppMessaging][I-IAM260010] App foregrounded, FIRIAMClearcutUploader will seed next send 11.2.0 - [FirebaseInAppMessaging][I-IAM260006] Next upload attempt scheduled in 0 seconds 11.2.0 - [FirebaseInAppMessaging][I-IAM230005] Returning 0 clearcut retry records from popStillValidRecords 11.2.0 - [FirebaseInAppMessaging][I-IAM260007] No clearcut records to be uploaded 11.2.0 - [FirebaseInAppMessaging][I-IAM260010] App foregrounded, FIRIAMClearcutUploader will seed next send 11.2.0 - [FirebaseInAppMessaging][I-IAM260006] Next upload attempt scheduled in 0 seconds 11.2.0 - [FirebaseRemoteConfig][I-RCN000039] Starting requesting token. 11.2.0 - [FirebaseInAppMessaging][I-IAM230005] Returning 0 clearcut retry records from popStillValidRecords 11.2.0 - [FirebaseInAppMessaging][I-IAM260007] No clearcut records to be uploaded [registerFileListener] Called 0 11.2.0 - [FirebaseFirestore][I-FST000001] Initializing. Current user: 11.2.0 - [FirebaseFirestore][I-FST000001] Using /Users//Library/Developer/CoreSimulator/Devices/7E91C279-26DB-461A-A0E9-105AF04A496A/data/Containers/Data/Application/5CDFA059-A572-4B71-9926-DCBC19F0E8F5/Library/Application Support/firestore/__FIRAPP_DEFAULT//main for LevelDB storage 11.2.0 - [FirebaseFirestore][I-FST000001] Committing transaction: WARNING: All log messages before absl::InitializeLog() is called are written to STDERR I0000 00:00:1726774218.352051 2171101 config.cc:230] gRPC experiments enabled: call_status_override_on_cancellation, http2_stats_fix, monitoring_experiment, pick_first_new, trace_record_callops, work_serializer_clears_time_cache 11.2.0 - [FirebaseFirestore][I-FST000001] Committing transaction: 11.2.0 - [FirebaseFirestore][I-FST000001] Committing transaction: 11.2.0 - [FirebaseFirestore][I-FST000001] Committing transaction: 11.2.0 - [FirebaseFirestore][I-FST000001] Committing transaction: 11.2.0 - [FirebaseFirestore][I-FST000001] Committing transaction: 11.2.0 - [FirebaseFirestore][I-FST000001] Using full collection scan to execute query: Query(canonical_id=TrackedAssetFile/current|f:|ob:__name__asc) 11.2.0 - [FirebaseFirestore][I-FST000001] Committing transaction: 11.2.0 - [FirebaseFirestore][I-FST000001] WatchStream (2810) start 11.2.0 - [FirebaseAnalytics][I-ACS002001] APMExperimentAlarm fired 11.2.0 - [FirebaseAnalytics][I-ACS002003] APMExperimentAlarm canceled 11.2.0 - [FirebaseFirestore][I-FST000001] Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds. This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
MagicFlow29 commented 1 month ago

A fresh app did in fact connect successfully. Were you able to see anything in the logs? I'll start stripping the existing / production code base down to figure out what's caused it.... but feel it could be a setting somewhere that perhaps Apple isn't upgrading on pre-Xcode 16 apps...

MagicFlow29 commented 1 month ago

OK thanks for your help... realising this must be something specific to my app and not firebase, I did find that a memory leak within SwiftUI was introduced when deploying to iOS 18 devices which subsequently caused the issue with Firebase not being able to connect.