What I'm doing is exporting phone number & owner's name from iPhone address book.
Here is the code:
dbRef = Database.database().reference()
let nameData = ["contactName": contact.name ]
let phoneData = ["contactPhone": contact.phone]
self.dbRef.child("user/contacts").childByAutoId().setValue(nameData)
self.dbRef.child("user/contacts").observe(.value, with: { (snapshot) in
if let result = snapshot.children.allObjects as? [DataSnapshot] {
for child in result {
let orderID = child.key
self.dbRef.child("user/contacts").child(orderID).updateChildValues(phoneData)
}
}
})
But the result is looking like that: ContactPhone's values are changing automatically, non-stop until I stop the xCode simulator.
Can Somebody help me, please.. Thank you
