我更改了Firebase控制台上的权限,并设置为允许所有用户访问而无需身份验证。
我有以下代码:
AppDelegate.swift
func application(_ application: UIApplication,didFinishlaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
{
FirebaseApp.configure()
Utils.initApp()
return true
}
Utils.swift
import Foundation
import Firebase
class Utils
{
static var inventoryJsonString = "Inventory/Inventory.json"
static var oneMB : Int64 = 1024 * 1024
static func initApp()
{
getJsonDate(inventoryJsonString)
}
static func getJsonData(filePath: String)
{
let storageRef = Storage.storage().reference()
let jsonRef = storageRef.child("Inventory")
jsonRef.getData(maxSize: self.oneMB)
{
extractedData,error in
print("a")
if let error = error{
print("b")
}
else
{
print("c")
}
}
}
我正在调用该函数,但是什么也没发生-我没有收到错误,但没有得到url(也尝试过getData
却没有得到任何结果)。我三联检查了filePath
中的路径,这是正确的。
我在这里想念什么?