无法通过 Apple Silicon 上的 iOS 模拟器连接到 Firestore

问题描述

我正在尝试使用我的 M1 MacBook Air 访问我的 Firestore 实例,但没有成功。尝试通过 iOS 模拟器访问给出以下响应:

2021-01-20 09:18:11.747682-0500 TestApp[81986:3364534] 7.4.0 - [Firebase/Firestore][I-FST000001] WatchStream (600000541718) Stream error: 'Unavailable: Network connectivity changed'

2021-01-20 09:18:11.748325-0500 TestApp[81986:3364534] 7.4.0 - [Firebase/Firestore][I-FST000001] Could not reach Cloud Firestore backend. Connection Failed 1 times. Most recent error: Network connectivity changed
 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.

奇怪的是,它确实连接了一次 - 尽管这是很多次以前的事了。它能够提取我拥有的小数据集的快照。但是,它再也没有连接过,即使我更改了数据,也没有任何反应。我假设是因为它被缓存了。

我可以通过模拟器访问 Safari 和网站,所以我认为这不是实际的网络问题。

看看我如何在下面调用 Firestore:

    Firestore.firestore().collection("companies").getDocuments{(snapshot,error) in
            if error == nil {
                for document in snapshot!.documents {
                    let name = document.data()["name"] as? String
                    print(name)
                }
            } else {
                print(error ?? "UnkNown Error")
            }
        }

在下面查看我的 Podfile:

# Uncomment the next line to define a global platform for your project
# platform :ios,'9.0'

target 'Sesame' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Sesame
  pod 'Firebase/Firestore','7.4-M1'
  pod 'Firebase/Storage','7.4-M1'
  target 'SesameTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'SesameUITests' do
    # Pods for testing
  end
  post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
      end
"Podfile" 26L,654C

我应该在哪里解决此连接问题的任何想法?

解决方法

为任何可能遇到此问题的人回答我自己的问题 - 我“解决”了这个问题。我不得不使用我自己的 iPhone 并将代码部署到该设备,在那里它运行良好。我想这是一个 iOS 模拟器错误,特别是现在在 Apple Silicon 上。