当我向firebase询问以下内容时。
print("\(WarSerArray[CompanyData.companyName]!.allValues)")
print("keys\(WarSerArray[CompanyData.companyName]!.allKeys)")
它打印出这些信息。
[{
PhonNumber = 7607588500;
address = "2378 Primrose Ave. Vista, CA. 92083";
currentStoreArray = Headquarters;
email = "james@opportunitysoftware.com";
faxNumber = "";
key = "-KLSM8y0BDfs6B1jtsA5";
name = "Service Center 1";
}]
keys[-KLSM8y0BDfs6B1jtsA5]
[{
PhonNumber = 7607588500;
address = "2378 Primrose Ave. Vista, CA. 92083";
currentStoreArray = Headquarters;
email = "james@opportunitysoftware.com";
faxNumber = "";
key = "-KLSM8zu6AFKa7V0beCh";
name = "Warehouse 1";
}]
keys[-KLSM8zu6AFKa7V0beCh]
我如何获得名字?
答案 0 :(得分:0)
var CompanyData = CompanyDataStruct()
struct CompanyDataStruct {
var key = ""
var webpage:String! = ""
var OwnerName:String! = ""
var address:String! = ""
var managerPNumber:String = ""
var dueOnOrder = 0.0
var email:String! = ""
var fax:String! = ""
var itemsOrderHistory:String! = ""
var companyName:String! = ""
var money = 0.0
var notes:String! = ""
var tax = 0.0
var pNumber:String = ""
var ManagerContact = ""
var opw:String! = ""
var mpw:String! = ""
var OwedToCompany = 0.0
var OwedString:String! = ""
var taxID:String! = ""
var reSalesID:String! = ""
var BoxCount = 0
var secondTicketID:String! = ""
var secondTicketNumber = 0
var useSecondTicketID = false
var printerSettings = ""
var quoteDays = 0
var fulfillmentPrinter = false
var fulfillmentEmail = false
var printBill = false
var emailBill = false
var system = false
var printReceipt = false
var emailReceipt = false
var theFulFillEmail = ""
var logoName = ""
var delivery = false
var ac1 = ""
var ac2 = ""
var ac3 = ""
var storeID = ""
var warehouse = ""
var serviceCenter = ""
var currentStore = ""
var StoreCount = 0
var WareHouseCount = 0
var ServiceCenterCount = 0
var MoneySymbol = ""
var refundLevel = 0
var shareBarcode = true
var LoGoImage = DefaultImage
}
var WarehouseData2 = WareServiceStruct()
struct WareServiceStruct {
var name = String()
var address = String()
var currentStoreArray = String()
var phoneNumber = String()
var faxNumber = String()
var email = String()
var key = String()
}
let WareSerRef = FIRDatabase.database().reference().child("Owner").child("CompanyName").child("WareServ")
let WareSerRefName = FIRDatabase.database().reference().child("Owner").child("CompanyName").child("WareServ").child("name")
let WareSerRefAddress = FIRDatabase.database().reference().child("Owner").child("CompanyName").child("WareServ").child("address")
let WarSerRefCurrentStore = FIRDatabase.database().reference().child("Owner").child("CompanyName").child("WareServ").child("CurrentStore")
let WareSerRefPhone = FIRDatabase.database().reference().child("Owner").child("CompanyName").child("WareServ").child("PhoneNumber")
let WareSerRefFax = FIRDatabase.database().reference().child("Owner").child("CompanyName").child("WareServ").child("faxNumber")
let WareSerRefEmail = FIRDatabase.database().reference().child("Owner").child("CompanyName").child("WareServ").child("email")
let WareSerRefKey = FIRDatabase.database().reference().child("Owner").child("CompanyName").child("WareServ").child("key")
func WarehouseFirebaseSetter(sedner: WareServiceStruct) {
let key = WareSerRef.childByAutoId().key
WarehouseData2 = sedner
WarehouseData2.key = key
let WareToAdd = FBWarhouseData
let childUpdates = ["/Warehouse /\(CompanyData.companyName)/\(key)":WareToAdd]
WareSerRef.updateChildValues(childUpdates)
}
var FBWarhouseData = ["address" : WarehouseData2.address,"currentStoreArray" : WarehouseData2.currentStoreArray,"email" : WarehouseData2.email,"faxNumber" : WarehouseData2.faxNumber,"PhonNumber" : WarehouseData2.phoneNumber,"name" : WarehouseData2.name,"key" : WarehouseData2.key] as NSDictionary