In the documentation it says that I should use this code to set new value's:
self.ref.child("users").child(user.uid).setValue(["username": username])
This way, I can set an username. However, if I want to add another value later on, like XP points, I use the following line of code:
var XPPoints = 1
self.ref.child("users").child(user.uid).setValue(["XPPoints": XPPoints])
This, however, deletes the username value, or any other value that was stored before. It replaces all value's.
I tried also the second thing the docs are saying at: https://firebase.google.com/docs/database/ios/read-and-write#basic_write which is this line of code:
self.ref.child("users/(user.uid)/username").setValue(username)
This will crash my app instantly when starting up. My question is: How can I add data, and not replacing the old value's?
Edit:
Fixed it by changing the code to:
self.ref.child("users/\(user.uid)/username").setValue(username)
Your solution shouldn't fix the problem you are having. You need to use updateChildValues instead of setValue. This adds the values instead of overwriting everything in the referenced node.
Related
I have an strange error in my log and I am not sure what I need to check.
Invalid value for key 'relatedByAttribute' in 'WorkoutEntity' entity. Remove this key or add attribute
This is one place what I found where I use relatedByAttribute in WorkoutEntity
Do you have an idea what can I check as well to see issue.
I had the same problem. In my case, I opened the .xcdatamodeld with an external editor, looked for the "relatedByAttribute" label and found that the label was "relatedByAttribute " instead (note the blank space).
Removed the blank and worked since then.
I hope it's good for you! ;)
I am new to Flutter and Dart. I have implemented list as stack reference for code here. I am calculating path from one node to other in graph. Problem with code is it returns _GrowableList on which is either empty or null but my GetAnswer do returns a correct list(checked while debugging). Why it automatically converts it into growable, How can I have my normal list?
Here is snippet of code where I am passing my graph start node and end node to instance of GetAnswer and storing back result in path variable.
That's the real internal type for the list you created. However, it shouldn't really look like this in the tooltip, this is how it looks for me:
If you can provide code that reproduces showing the tooltip like that, I'd love to take a look. Please open a bug in GitHub.
(It's possible you're on v2.11 of Dart Code - if so, please update to v2.12 and this should be improved)
I tried to delete one child from Firebase, however, it is not removing it for some reason.
This is how I tied to delete it(I get the right reference):
FIRDatabase.database().reference().child("posts").child(commentsArray[indexPath.row].key).removeValue()
If I try to po this value the output is e.g:
https://snuspedia.firebaseio.com/posts/coments/-KTzfD1wOa9sRXw93gAF
Which is this:
Am I doing something wrong?
So what I recognize is that you miss the key of the post:
https://snuspedia.firebaseio.com/posts/<KEY OF YOUR POST>/comments/-KTzfD1wOa9sRXw93gAF
Reference code should include the key of the specific post:
FIRDatabase.database().reference().child("posts").child(<KEY OF YOUR POST>).child("comments").child(commentsArray[indexPath.row].key).removeValue()
I'm currently using Xcode version 7.2.1, and I'm getting weird values displayed for most values in the debugger. The weird thing is it's always the same value. Other than a few values, all variables are listed as containing the value "00:30:00". The best way to show this is to give you an example.
I have tried restarting Xcode, clean and build, re-booting, and even re-installing Xcode, but I can't seem to escape this weird value. If I put in print statements, all the values show up correctly in the console. Is there any way I can get them to be correct in the debugger? Thanks.
Edit:
This is kind of interesting. If I move the mouse pointer over one of the entries, you can see that it displays "00:30:00", but if I inspect the value, it displays the correct date value.
I finally figured it out! I must have typed something in the "Edit Summary Format..." popup. It took it as a literal format string and displayed it for all string values from thereafter. Once I removed that, everything went back to normal.
We have created a Custom List template programmatically using Feature.xml, Element.xml, Schema.xml AllItems.aspx, and 3 aspx forms. We have a code behind file for each of these aspx files. i.e. for the AllItems.aspx, DispForm.aspx, EditForm.aspx and NewForm.aspx.
Problematic file is AllItems.aspx. In the code behind for AllItems.aspx file we are deleting previous list items and adding new items to the list before showing them up to the user. As per expectations the code behind file for AllItems.aspx is derived from WebPartPage Class and we have tried to overload quite a few methods without much success.
Problem only occurs on the first time rendering i.e. when an instance of this list is created. When overriding OnLoad(), we get the Save conflict error, Similar is the case with OnInit(), CreateChildControls() method. However, when we override the Render() or RenderChildren() method no such error comes up but at the same time our new list items are also not visible. On browser refresh everything starts working fine as expected. It is only for the first time that the issue comes up.
What could be the possible cause for this? Any ideas, suggestions would be highly appreciated.
Best Regards,
Raghu
I had a problem with a custom EditForm.aspx. I have two lists that are linked together and a change in one causes an event handler to update the other. I have a custom control in EditForm.aspx that edits the linked list. This was causing the event handler to update the item displayed by EditForm.aspx. This in turn would cause the conflict error when the user saved the form.
I finally found that I could reset the context with:
SPContext.Current.ResetItem();
I am not sure if this will help in your case but it fixed my problem.