You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

已配置Firebase/Firestore却触发[Firestore][I-FST000001]错误,Swift4+Xcode9求解决

Hey there, let's tackle this Firestore backend connection issue you're facing with Swift 4 and Xcode 9. I've run into similar headaches before, so here are some actionable steps to troubleshoot:

Firestore Connection Error Troubleshooting for Swift 4 & Xcode 9

1. Double-check Network & Firewall Settings

  • First, confirm your test device (simulator or physical device) has a stable internet connection—Firestore relies on uninterrupted network access.
  • If you're on a corporate or campus network, firewalls might block Firestore's communication ports. Try switching to a personal hotspot to rule this out.
  • Disable any VPN or proxy tools temporarily; these can interfere with Firestore's ability to reach its backend servers.

2. Validate Firebase Configuration File

  • Re-download the GoogleService-Info.plist directly from your Firebase project dashboard. Make sure you're grabbing the file for the correct project environment (no mixing up staging and production configs!).
  • Verify the plist is properly added to your Xcode project: Go to your project settings → Build Phases → Copy Bundle Resources, and ensure GoogleService-Info.plist is listed without red warnings.

3. Lock Firebase SDK to a Compatible Version

  • Swift 4 and Xcode 9 don't support the latest Firebase SDKs. Stick to a version that's verified to work with your setup—6.13.0 is a safe bet. Update your Podfile like this:
    pod 'Firebase/Core', '~> 6.13.0'
    pod 'Firebase/Firestore', '~> 6.13.0'
    
    Then run pod install --repo-update to refresh your dependencies.

4. Test with Relaxed Firestore Security Rules

  • While this error is usually connection-related, overly strict security rules can sometimes cause unexpected issues. For debugging only, set your rules to test mode (remember to revert this before launching):
    rules_version = '2';
    service cloud.firestore {
      match /databases/{database}/documents {
        match /{document=**} {
          allow read, write: if request.time < timestamp.date(2024, 12, 31);
        }
      }
    }
    
    Deploy the rules and test your connection again.

5. Enable Firestore Debug Logs

  • Get more detailed error context by enabling debug logging when your app starts. Add this code to your app delegate:
    import FirebaseCore
    import FirebaseFirestore
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
      FirebaseApp.configure()
      // Turn on Firestore debug logging
      Firestore.enableLogging(true)
      return true
    }
    
    Check the Xcode console for specific errors (like DNS failures or SSL certificate issues) that might point to the root cause.

6. Clean Project Caches & Rebuild

  • Clear Xcode's cached data: Press Command + Shift + Option + K to clean build folder, then Command + Shift + K to clean regular build files.
  • Delete the DerivedData folder: Go to Xcode → Preferences → Locations, click the arrow next to the DerivedData path, and delete the folder for your project.
  • Try rebuilding the project, or testing on a physical device instead of the simulator—simulators can sometimes have network caching quirks.

内容的提问来源于stack exchange,提问作者richardfrk

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 08:02:45