我想在我的博览会应用程序上使用Firestore。但是,当我尝试将一些数据发送到Firestore时出现错误。这是我第一次遇到此错误。
我试图将其从6.1.1降级到5.9.3,我检查了Firestore云设置,一切运行正常。
@firebase/firestore:, Firestore (5.11.0): INTERNAL UNHANDLED ERROR: , configureNetworkMonitoring@http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:191066:30
BrowserConnectivityMonitor@http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:191053:38
newConnectivityMonitor@http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:191430:46
http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:201508:75
step@http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:157573:27
http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:157503:22
http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:157475:75
tryCallTwo@http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:3756:9
doResolve@http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:3920:25
Promise@http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:3779:14
__awaiter@http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:157452:38
tryCallOne@http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:3747:16
http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:3848:27
_callTimer@http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:28259:17
_callImmediatesPass@http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:28295:19
callImmediates@http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:28514:33
callImmediates@[native code]
__callImmediates@http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:3149:35
http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:2970:34
__guard@http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:3132:15
flushedQueue@http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:2969:21
flushedQueue@[native code]
这是错误
class ViewController: UIViewController {
@IBOutlet weak var collectionView: UICollectionView!
private var isRefreshing = true
var arrayOfData = [GettingMoney]()
override func viewDidLoad() {
super.viewDidLoad()
let refreshControl = UIRefreshControl()
refreshControl.tintColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
collectionView.refreshControl = refreshControl
collectionView.refreshControl?.beginRefreshing()
fetchData()
collectionView.dataSource = self
collectionView.delegate = self
}
func fetchData () {
let url = "SOMEAPI"
guard let urlString = URL(string: url) else { return }
URLSession.shared.dataTask(with: urlString) { (data, _, _) in
guard let data = data else { return }
do {
let getData = try JSONDecoder().decode(GettingMoney.self, from: data)
print("getSomeData")
DispatchQueue.main.async {
self.arrayOfData = [getData]
self.collectionView?.reloadData()
self.collectionView.refreshControl?.endRefreshing()
print("reload Data")
}
} catch {
print("Its a error")
}
}.resume()
}
}
extension ViewController: UICollectionViewDelegate, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 3
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "collectionCellId", for: indexPath) as? CollectionViewCell {
let arry = arrayOfData[indexPath.row] // <-- here is got error: Fatal error: Index out of range
print("is Ok")
cell.currectCurrency.text = "\(arry.USD))"
print(arrayOfData)
return cell
}
return UICollectionViewCell()
}
}