When I want to add String(beacons[index].major.stringValue)
for example in my dictionary I get the following error:
Value of type "[String : String]" has no member 'major'
if(beacons.count > 0) {
let nearestBeacon:CLBeacon = beacons[0]
for var index = 0; index < beacons.count; index++ {
let uuidString = "00000000-0000-0000-0000-000000000000"
var beacons: [Dictionary<String, String>] = []
beacons.append(["uuid": uuidString, "major": String(beacons[index].major.stringValue), "minor": beacons[index].minor.stringValue, "accurency": String(beacons[index].accuracy)])
Server.beaconsSend(beacons) { // success, data in
print(data)
}
}
}
Probably because you created a beacons dictionary while you are in a condition (if else) on a beacons array. The beacons you created now hides the beacon array, and you are refering only to the dictionary