我的应用程序中包含以下代码。
public void onAddField(View v) {
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View rowView = inflater.inflate(R.layout.field, null);
parentLinearLayout.addView(rowView, parentLinearLayout.getChildCount() - 1);
}
public void onDelete(View v) {
parentLinearLayout.removeView((View) v.getParent());
}
注销操作在删除之前完成,因此无法在Firestore上完成删除。我如何等待尝试注销,直到删除功能完成?
答案 0 :(得分:0)
您可以使用闭包:
db.collection("users").document(currentUserId).updateData(["Token": FieldValue.delete()]) {
err in
if err == nil {
do {
try Auth.auth().signOut()
} catch let error {
// Sign out failed with error, do something
}
} else {
// Update database error, do something
}
}