How do I set my variable correctly to a value on Firebase and not have it reset the progress?

Multi tool use
up vote
0
down vote
favorite
Everytime I leave this ViewController and then come back the quiz starts back to question 1. I want it to resume from where I left off.
I believe why it keeps resetting to zero is because my initial "questionNumber" is set to 0 but I'm not sure how to set its value to the value in Firebase correctly. I get error after error. I've tried so many different ways but none of them seem to work and resume from where I left off.
Thanks for your help! PLEASE help me!
class CryptoViewController: UIViewController {
var questionList = CryptoBank()
var score = 0
var pickedQuestion = 0
var uid = FIRAuth.auth()?.currentUser?.uid
var questionNumber = 0
@IBOutlet weak var questionViewer: UILabel!
@IBOutlet weak var choiceOne: UIButton!
@IBOutlet weak var choiceTwo: UIButton!
@IBOutlet weak var choiceThree: UIButton!
@IBOutlet weak var scoreLabel: UILabel!
@IBOutlet weak var questionNumberView: UILabel!
@IBOutlet weak var progressBarView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
choiceOne.titleLabel?.textAlignment = NSTextAlignment.center
choiceTwo.titleLabel?.textAlignment = NSTextAlignment.center
choiceThree.titleLabel?.textAlignment = NSTextAlignment.center
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.view.backgroundColor = .clear
update()
}
@IBAction func buttonPressed(_ sender: AnyObject) {
if sender.tag == 1 {
pickedQuestion = 1}
else if sender.tag == 2 {
pickedQuestion = 2}
else if sender.tag == 3 {
pickedQuestion = 3}
checkAnswer()
questionNumber += 1
nextQuestion()
}
func checkAnswer(){
let correctAnswer = questionList.cryptoBank[questionNumber].answer
if pickedQuestion == correctAnswer {
score += 1
}else{
print("Wrong Answer")
}
}
func updateFirebase(){
let ref = FIRDatabase.database().reference()
guard let uid = FIRAuth.auth()?.currentUser!.uid else{
return}
ref.child("Users").child(uid).child("Cryptoquiz").child("Question Number").setValue(questionNumber)
ref.child("Users").child(uid).child("Cryptoquiz").child("Score").setValue(score)
}
func nextQuestion(){
if questionNumber <= 9 {
update()
} else{
scoreLabel.text = "Score: (score)"
let alert = UIAlertController(title: "Done!", message: "Would you like to restart?", preferredStyle: .alert)
let restartAction = UIAlertAction(title: "Restart", style: .default, handler: { (UIAlertAction) in
self.startAgain()
})
alert.addAction(restartAction)
present(alert, animated: true, completion: nil)
}}
func update(){
let nextQuest = questionList.cryptoBank[questionNumber]
questionViewer.text = nextQuest.question
choiceOne.setTitle(nextQuest.choice1, for: .normal)
choiceTwo.setTitle(nextQuest.choice2, for: .normal)
choiceThree.setTitle(nextQuest.choice3, for: .normal)
scoreLabel.text = "Score: (score)"
questionNumberView.text = "Question: (questionNumber + 1)"
progressBarView.frame.size.width = (view.frame.size.width/9) * CGFloat(questionNumber + 1)
updateFirebase()
}
}
swift

add a comment |
up vote
0
down vote
favorite
Everytime I leave this ViewController and then come back the quiz starts back to question 1. I want it to resume from where I left off.
I believe why it keeps resetting to zero is because my initial "questionNumber" is set to 0 but I'm not sure how to set its value to the value in Firebase correctly. I get error after error. I've tried so many different ways but none of them seem to work and resume from where I left off.
Thanks for your help! PLEASE help me!
class CryptoViewController: UIViewController {
var questionList = CryptoBank()
var score = 0
var pickedQuestion = 0
var uid = FIRAuth.auth()?.currentUser?.uid
var questionNumber = 0
@IBOutlet weak var questionViewer: UILabel!
@IBOutlet weak var choiceOne: UIButton!
@IBOutlet weak var choiceTwo: UIButton!
@IBOutlet weak var choiceThree: UIButton!
@IBOutlet weak var scoreLabel: UILabel!
@IBOutlet weak var questionNumberView: UILabel!
@IBOutlet weak var progressBarView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
choiceOne.titleLabel?.textAlignment = NSTextAlignment.center
choiceTwo.titleLabel?.textAlignment = NSTextAlignment.center
choiceThree.titleLabel?.textAlignment = NSTextAlignment.center
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.view.backgroundColor = .clear
update()
}
@IBAction func buttonPressed(_ sender: AnyObject) {
if sender.tag == 1 {
pickedQuestion = 1}
else if sender.tag == 2 {
pickedQuestion = 2}
else if sender.tag == 3 {
pickedQuestion = 3}
checkAnswer()
questionNumber += 1
nextQuestion()
}
func checkAnswer(){
let correctAnswer = questionList.cryptoBank[questionNumber].answer
if pickedQuestion == correctAnswer {
score += 1
}else{
print("Wrong Answer")
}
}
func updateFirebase(){
let ref = FIRDatabase.database().reference()
guard let uid = FIRAuth.auth()?.currentUser!.uid else{
return}
ref.child("Users").child(uid).child("Cryptoquiz").child("Question Number").setValue(questionNumber)
ref.child("Users").child(uid).child("Cryptoquiz").child("Score").setValue(score)
}
func nextQuestion(){
if questionNumber <= 9 {
update()
} else{
scoreLabel.text = "Score: (score)"
let alert = UIAlertController(title: "Done!", message: "Would you like to restart?", preferredStyle: .alert)
let restartAction = UIAlertAction(title: "Restart", style: .default, handler: { (UIAlertAction) in
self.startAgain()
})
alert.addAction(restartAction)
present(alert, animated: true, completion: nil)
}}
func update(){
let nextQuest = questionList.cryptoBank[questionNumber]
questionViewer.text = nextQuest.question
choiceOne.setTitle(nextQuest.choice1, for: .normal)
choiceTwo.setTitle(nextQuest.choice2, for: .normal)
choiceThree.setTitle(nextQuest.choice3, for: .normal)
scoreLabel.text = "Score: (score)"
questionNumberView.text = "Question: (questionNumber + 1)"
progressBarView.frame.size.width = (view.frame.size.width/9) * CGFloat(questionNumber + 1)
updateFirebase()
}
}
swift

add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Everytime I leave this ViewController and then come back the quiz starts back to question 1. I want it to resume from where I left off.
I believe why it keeps resetting to zero is because my initial "questionNumber" is set to 0 but I'm not sure how to set its value to the value in Firebase correctly. I get error after error. I've tried so many different ways but none of them seem to work and resume from where I left off.
Thanks for your help! PLEASE help me!
class CryptoViewController: UIViewController {
var questionList = CryptoBank()
var score = 0
var pickedQuestion = 0
var uid = FIRAuth.auth()?.currentUser?.uid
var questionNumber = 0
@IBOutlet weak var questionViewer: UILabel!
@IBOutlet weak var choiceOne: UIButton!
@IBOutlet weak var choiceTwo: UIButton!
@IBOutlet weak var choiceThree: UIButton!
@IBOutlet weak var scoreLabel: UILabel!
@IBOutlet weak var questionNumberView: UILabel!
@IBOutlet weak var progressBarView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
choiceOne.titleLabel?.textAlignment = NSTextAlignment.center
choiceTwo.titleLabel?.textAlignment = NSTextAlignment.center
choiceThree.titleLabel?.textAlignment = NSTextAlignment.center
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.view.backgroundColor = .clear
update()
}
@IBAction func buttonPressed(_ sender: AnyObject) {
if sender.tag == 1 {
pickedQuestion = 1}
else if sender.tag == 2 {
pickedQuestion = 2}
else if sender.tag == 3 {
pickedQuestion = 3}
checkAnswer()
questionNumber += 1
nextQuestion()
}
func checkAnswer(){
let correctAnswer = questionList.cryptoBank[questionNumber].answer
if pickedQuestion == correctAnswer {
score += 1
}else{
print("Wrong Answer")
}
}
func updateFirebase(){
let ref = FIRDatabase.database().reference()
guard let uid = FIRAuth.auth()?.currentUser!.uid else{
return}
ref.child("Users").child(uid).child("Cryptoquiz").child("Question Number").setValue(questionNumber)
ref.child("Users").child(uid).child("Cryptoquiz").child("Score").setValue(score)
}
func nextQuestion(){
if questionNumber <= 9 {
update()
} else{
scoreLabel.text = "Score: (score)"
let alert = UIAlertController(title: "Done!", message: "Would you like to restart?", preferredStyle: .alert)
let restartAction = UIAlertAction(title: "Restart", style: .default, handler: { (UIAlertAction) in
self.startAgain()
})
alert.addAction(restartAction)
present(alert, animated: true, completion: nil)
}}
func update(){
let nextQuest = questionList.cryptoBank[questionNumber]
questionViewer.text = nextQuest.question
choiceOne.setTitle(nextQuest.choice1, for: .normal)
choiceTwo.setTitle(nextQuest.choice2, for: .normal)
choiceThree.setTitle(nextQuest.choice3, for: .normal)
scoreLabel.text = "Score: (score)"
questionNumberView.text = "Question: (questionNumber + 1)"
progressBarView.frame.size.width = (view.frame.size.width/9) * CGFloat(questionNumber + 1)
updateFirebase()
}
}
swift

Everytime I leave this ViewController and then come back the quiz starts back to question 1. I want it to resume from where I left off.
I believe why it keeps resetting to zero is because my initial "questionNumber" is set to 0 but I'm not sure how to set its value to the value in Firebase correctly. I get error after error. I've tried so many different ways but none of them seem to work and resume from where I left off.
Thanks for your help! PLEASE help me!
class CryptoViewController: UIViewController {
var questionList = CryptoBank()
var score = 0
var pickedQuestion = 0
var uid = FIRAuth.auth()?.currentUser?.uid
var questionNumber = 0
@IBOutlet weak var questionViewer: UILabel!
@IBOutlet weak var choiceOne: UIButton!
@IBOutlet weak var choiceTwo: UIButton!
@IBOutlet weak var choiceThree: UIButton!
@IBOutlet weak var scoreLabel: UILabel!
@IBOutlet weak var questionNumberView: UILabel!
@IBOutlet weak var progressBarView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
choiceOne.titleLabel?.textAlignment = NSTextAlignment.center
choiceTwo.titleLabel?.textAlignment = NSTextAlignment.center
choiceThree.titleLabel?.textAlignment = NSTextAlignment.center
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.view.backgroundColor = .clear
update()
}
@IBAction func buttonPressed(_ sender: AnyObject) {
if sender.tag == 1 {
pickedQuestion = 1}
else if sender.tag == 2 {
pickedQuestion = 2}
else if sender.tag == 3 {
pickedQuestion = 3}
checkAnswer()
questionNumber += 1
nextQuestion()
}
func checkAnswer(){
let correctAnswer = questionList.cryptoBank[questionNumber].answer
if pickedQuestion == correctAnswer {
score += 1
}else{
print("Wrong Answer")
}
}
func updateFirebase(){
let ref = FIRDatabase.database().reference()
guard let uid = FIRAuth.auth()?.currentUser!.uid else{
return}
ref.child("Users").child(uid).child("Cryptoquiz").child("Question Number").setValue(questionNumber)
ref.child("Users").child(uid).child("Cryptoquiz").child("Score").setValue(score)
}
func nextQuestion(){
if questionNumber <= 9 {
update()
} else{
scoreLabel.text = "Score: (score)"
let alert = UIAlertController(title: "Done!", message: "Would you like to restart?", preferredStyle: .alert)
let restartAction = UIAlertAction(title: "Restart", style: .default, handler: { (UIAlertAction) in
self.startAgain()
})
alert.addAction(restartAction)
present(alert, animated: true, completion: nil)
}}
func update(){
let nextQuest = questionList.cryptoBank[questionNumber]
questionViewer.text = nextQuest.question
choiceOne.setTitle(nextQuest.choice1, for: .normal)
choiceTwo.setTitle(nextQuest.choice2, for: .normal)
choiceThree.setTitle(nextQuest.choice3, for: .normal)
scoreLabel.text = "Score: (score)"
questionNumberView.text = "Question: (questionNumber + 1)"
progressBarView.frame.size.width = (view.frame.size.width/9) * CGFloat(questionNumber + 1)
updateFirebase()
}
}
swift

swift

edited Nov 7 at 7:14


PradyumanDixit
1,7971718
1,7971718
asked Nov 7 at 6:03
Tim Kruger
591235
591235
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
You can save your progress in UserDefaults
in viewDidDisappear()
like this:
UserDefaults.standard.set(questionNumber, forKey: "questionNumber")
And then every time you open your view, in viewDidLoad()
or in viewDidAppear()
you update your questionNumber like this:
let questionNumberSaved = UserDefaults.standard.integer(forKey: “questionNumber”) ?? 0
questionNumber = questionNumberSaved
Then after doing this you call your updateFirebase()
method
I did like you said and tried a few other things but it's still always resetting to 0 when returning to the viewController. Thanks for trying to help....I appreciate it alot.
– Tim Kruger
Nov 7 at 16:41
Where did you put loading scores code? And where did you try to save questionNumber? Did you print question number after you loaded it from user defaults?
– DionizB
Nov 7 at 16:43
I update the questionNumber var in Firebase, in the updateFirebase func I created. I've tried to print out statements in various places a to see when it resets to 0. For what what I understand it switches to 0 not when I go back to the quiz choice page but when I return to this page. Firebase's data reverts back to 0 when I click on the quiz I want to take. The inital value when I set up questionNumber is 0 but everything I try to get it set to the value in Firebase doesn't work. I've tried to reset it in viewDidLoad to the firebase value but it never works. It still resets to 0
– Tim Kruger
Nov 7 at 16:59
1
What does it print after this linelet questionNumberSaved = UserDefaults.standard.integer(forKey: “questionNumber”) ?? 0
– DionizB
Nov 7 at 17:00
1
Are you sure you did save question number in UserDefaults? Try placing thisUserDefaults.standard.set(questionNumber, forKey: "questionNumber")
inside yourupdateFirebase()
method
– DionizB
Nov 7 at 18:31
|
show 3 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
You can save your progress in UserDefaults
in viewDidDisappear()
like this:
UserDefaults.standard.set(questionNumber, forKey: "questionNumber")
And then every time you open your view, in viewDidLoad()
or in viewDidAppear()
you update your questionNumber like this:
let questionNumberSaved = UserDefaults.standard.integer(forKey: “questionNumber”) ?? 0
questionNumber = questionNumberSaved
Then after doing this you call your updateFirebase()
method
I did like you said and tried a few other things but it's still always resetting to 0 when returning to the viewController. Thanks for trying to help....I appreciate it alot.
– Tim Kruger
Nov 7 at 16:41
Where did you put loading scores code? And where did you try to save questionNumber? Did you print question number after you loaded it from user defaults?
– DionizB
Nov 7 at 16:43
I update the questionNumber var in Firebase, in the updateFirebase func I created. I've tried to print out statements in various places a to see when it resets to 0. For what what I understand it switches to 0 not when I go back to the quiz choice page but when I return to this page. Firebase's data reverts back to 0 when I click on the quiz I want to take. The inital value when I set up questionNumber is 0 but everything I try to get it set to the value in Firebase doesn't work. I've tried to reset it in viewDidLoad to the firebase value but it never works. It still resets to 0
– Tim Kruger
Nov 7 at 16:59
1
What does it print after this linelet questionNumberSaved = UserDefaults.standard.integer(forKey: “questionNumber”) ?? 0
– DionizB
Nov 7 at 17:00
1
Are you sure you did save question number in UserDefaults? Try placing thisUserDefaults.standard.set(questionNumber, forKey: "questionNumber")
inside yourupdateFirebase()
method
– DionizB
Nov 7 at 18:31
|
show 3 more comments
up vote
1
down vote
You can save your progress in UserDefaults
in viewDidDisappear()
like this:
UserDefaults.standard.set(questionNumber, forKey: "questionNumber")
And then every time you open your view, in viewDidLoad()
or in viewDidAppear()
you update your questionNumber like this:
let questionNumberSaved = UserDefaults.standard.integer(forKey: “questionNumber”) ?? 0
questionNumber = questionNumberSaved
Then after doing this you call your updateFirebase()
method
I did like you said and tried a few other things but it's still always resetting to 0 when returning to the viewController. Thanks for trying to help....I appreciate it alot.
– Tim Kruger
Nov 7 at 16:41
Where did you put loading scores code? And where did you try to save questionNumber? Did you print question number after you loaded it from user defaults?
– DionizB
Nov 7 at 16:43
I update the questionNumber var in Firebase, in the updateFirebase func I created. I've tried to print out statements in various places a to see when it resets to 0. For what what I understand it switches to 0 not when I go back to the quiz choice page but when I return to this page. Firebase's data reverts back to 0 when I click on the quiz I want to take. The inital value when I set up questionNumber is 0 but everything I try to get it set to the value in Firebase doesn't work. I've tried to reset it in viewDidLoad to the firebase value but it never works. It still resets to 0
– Tim Kruger
Nov 7 at 16:59
1
What does it print after this linelet questionNumberSaved = UserDefaults.standard.integer(forKey: “questionNumber”) ?? 0
– DionizB
Nov 7 at 17:00
1
Are you sure you did save question number in UserDefaults? Try placing thisUserDefaults.standard.set(questionNumber, forKey: "questionNumber")
inside yourupdateFirebase()
method
– DionizB
Nov 7 at 18:31
|
show 3 more comments
up vote
1
down vote
up vote
1
down vote
You can save your progress in UserDefaults
in viewDidDisappear()
like this:
UserDefaults.standard.set(questionNumber, forKey: "questionNumber")
And then every time you open your view, in viewDidLoad()
or in viewDidAppear()
you update your questionNumber like this:
let questionNumberSaved = UserDefaults.standard.integer(forKey: “questionNumber”) ?? 0
questionNumber = questionNumberSaved
Then after doing this you call your updateFirebase()
method
You can save your progress in UserDefaults
in viewDidDisappear()
like this:
UserDefaults.standard.set(questionNumber, forKey: "questionNumber")
And then every time you open your view, in viewDidLoad()
or in viewDidAppear()
you update your questionNumber like this:
let questionNumberSaved = UserDefaults.standard.integer(forKey: “questionNumber”) ?? 0
questionNumber = questionNumberSaved
Then after doing this you call your updateFirebase()
method
answered Nov 7 at 9:16
DionizB
707310
707310
I did like you said and tried a few other things but it's still always resetting to 0 when returning to the viewController. Thanks for trying to help....I appreciate it alot.
– Tim Kruger
Nov 7 at 16:41
Where did you put loading scores code? And where did you try to save questionNumber? Did you print question number after you loaded it from user defaults?
– DionizB
Nov 7 at 16:43
I update the questionNumber var in Firebase, in the updateFirebase func I created. I've tried to print out statements in various places a to see when it resets to 0. For what what I understand it switches to 0 not when I go back to the quiz choice page but when I return to this page. Firebase's data reverts back to 0 when I click on the quiz I want to take. The inital value when I set up questionNumber is 0 but everything I try to get it set to the value in Firebase doesn't work. I've tried to reset it in viewDidLoad to the firebase value but it never works. It still resets to 0
– Tim Kruger
Nov 7 at 16:59
1
What does it print after this linelet questionNumberSaved = UserDefaults.standard.integer(forKey: “questionNumber”) ?? 0
– DionizB
Nov 7 at 17:00
1
Are you sure you did save question number in UserDefaults? Try placing thisUserDefaults.standard.set(questionNumber, forKey: "questionNumber")
inside yourupdateFirebase()
method
– DionizB
Nov 7 at 18:31
|
show 3 more comments
I did like you said and tried a few other things but it's still always resetting to 0 when returning to the viewController. Thanks for trying to help....I appreciate it alot.
– Tim Kruger
Nov 7 at 16:41
Where did you put loading scores code? And where did you try to save questionNumber? Did you print question number after you loaded it from user defaults?
– DionizB
Nov 7 at 16:43
I update the questionNumber var in Firebase, in the updateFirebase func I created. I've tried to print out statements in various places a to see when it resets to 0. For what what I understand it switches to 0 not when I go back to the quiz choice page but when I return to this page. Firebase's data reverts back to 0 when I click on the quiz I want to take. The inital value when I set up questionNumber is 0 but everything I try to get it set to the value in Firebase doesn't work. I've tried to reset it in viewDidLoad to the firebase value but it never works. It still resets to 0
– Tim Kruger
Nov 7 at 16:59
1
What does it print after this linelet questionNumberSaved = UserDefaults.standard.integer(forKey: “questionNumber”) ?? 0
– DionizB
Nov 7 at 17:00
1
Are you sure you did save question number in UserDefaults? Try placing thisUserDefaults.standard.set(questionNumber, forKey: "questionNumber")
inside yourupdateFirebase()
method
– DionizB
Nov 7 at 18:31
I did like you said and tried a few other things but it's still always resetting to 0 when returning to the viewController. Thanks for trying to help....I appreciate it alot.
– Tim Kruger
Nov 7 at 16:41
I did like you said and tried a few other things but it's still always resetting to 0 when returning to the viewController. Thanks for trying to help....I appreciate it alot.
– Tim Kruger
Nov 7 at 16:41
Where did you put loading scores code? And where did you try to save questionNumber? Did you print question number after you loaded it from user defaults?
– DionizB
Nov 7 at 16:43
Where did you put loading scores code? And where did you try to save questionNumber? Did you print question number after you loaded it from user defaults?
– DionizB
Nov 7 at 16:43
I update the questionNumber var in Firebase, in the updateFirebase func I created. I've tried to print out statements in various places a to see when it resets to 0. For what what I understand it switches to 0 not when I go back to the quiz choice page but when I return to this page. Firebase's data reverts back to 0 when I click on the quiz I want to take. The inital value when I set up questionNumber is 0 but everything I try to get it set to the value in Firebase doesn't work. I've tried to reset it in viewDidLoad to the firebase value but it never works. It still resets to 0
– Tim Kruger
Nov 7 at 16:59
I update the questionNumber var in Firebase, in the updateFirebase func I created. I've tried to print out statements in various places a to see when it resets to 0. For what what I understand it switches to 0 not when I go back to the quiz choice page but when I return to this page. Firebase's data reverts back to 0 when I click on the quiz I want to take. The inital value when I set up questionNumber is 0 but everything I try to get it set to the value in Firebase doesn't work. I've tried to reset it in viewDidLoad to the firebase value but it never works. It still resets to 0
– Tim Kruger
Nov 7 at 16:59
1
1
What does it print after this line
let questionNumberSaved = UserDefaults.standard.integer(forKey: “questionNumber”) ?? 0
– DionizB
Nov 7 at 17:00
What does it print after this line
let questionNumberSaved = UserDefaults.standard.integer(forKey: “questionNumber”) ?? 0
– DionizB
Nov 7 at 17:00
1
1
Are you sure you did save question number in UserDefaults? Try placing this
UserDefaults.standard.set(questionNumber, forKey: "questionNumber")
inside your updateFirebase()
method– DionizB
Nov 7 at 18:31
Are you sure you did save question number in UserDefaults? Try placing this
UserDefaults.standard.set(questionNumber, forKey: "questionNumber")
inside your updateFirebase()
method– DionizB
Nov 7 at 18:31
|
show 3 more comments
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53184310%2fhow-do-i-set-my-variable-correctly-to-a-value-on-firebase-and-not-have-it-reset%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
2J,hfC83Q HwhVk Y MM