how to write data on firebase at three diffrent node at one without closing view controllerPassing Data between View ControllersHow to store and view images on firebase?How to force view controller orientation in iOS 8?Wait until swift for loop with asynchronous network requests finishes executingObserver Fires Multiple Times with removeAllOberversFirebase Rest API Streaming error: Connection gets closed when child has huge data in itHow to treat multiple writes so that if one write fails, the data isn't committed?Does firebase functions keep running after dissiming a view-controllerFirebase - How to update a list of data?Firebase on android how to return only the node without children
What are the advantages and disadvantages of tail wheels that cause modern airplanes to not use them?
Can I travel to European countries with the Irish passport and without destination Visa?
If I want an interpretable model, are there methods other than Linear Regression?
What's the benefit of prohibiting the use of techniques/language constructs that have not been taught?
Wrong Schengen Visa exit stamp on my passport, who can I complain to?
Masking out non-linear shapes on canvas
Why are some files not movable on Windows 10?
How to give my students a straightedge instead of a ruler
Read string of any length in C
What is the mathematical notation for rounding a given number to the nearest integer?
Python web-scraper to download table of transistor counts from Wikipedia
What 68-pin connector is this on my 2.5" solid state drive?
Examples of proofs by making reduction to a finite set
In what sequence should an advanced civilization teach technology to medieval society to maximize rate of adoption?
How can I say "I want to" as a short response, omitting the main verb?
Meaning of Swimming their horses
How do certain apps show new notifications when internet access is restricted to them?
Bash awk command with quotes
Is "you will become a subject matter expert" code for "you'll be working on your own 100% of the time"?
Is there a tool to measure the "maturity" of a code in Git?
Why any infinite sequence of real functions can be generated from a finite set through composition?
Is there any reason to concentrate on the Thunderous Smite spell after using its effects?
Impossible Scrabble Words
What would happen if Protagoras v Euathlus were heard in court today?
how to write data on firebase at three diffrent node at one without closing view controller
Passing Data between View ControllersHow to store and view images on firebase?How to force view controller orientation in iOS 8?Wait until swift for loop with asynchronous network requests finishes executingObserver Fires Multiple Times with removeAllOberversFirebase Rest API Streaming error: Connection gets closed when child has huge data in itHow to treat multiple writes so that if one write fails, the data isn't committed?Does firebase functions keep running after dissiming a view-controllerFirebase - How to update a list of data?Firebase on android how to return only the node without children
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Basically I am checking if some data exist in the firebase database or not using Database.database().reference().child(“users”).hasChild(“somename”)
if it has that some name then i want to write to three different node on firebase i.e at sender node at receiver node and at one more node
i am doing this by calling
Database.database().reference().child(“send).childbyautoid.servalue(somename: somevalue)
Database.database().reference().child(“receiver”).child(“receiverid”).childbyautoid.setvalue(somename: somevalue)
database.database.reference().child(“all”).childbyautoid.setvalue(somename: somevalue)
problem is i am doing it just before closing the view controller
so either i should wait for all of the fire to execute or controller dismisses only after calling one fire
is this a bad design what should i do to close the controller immediately and also get the data at three places on firebase
ios swift firebase-realtime-database database-schema
add a comment
|
Basically I am checking if some data exist in the firebase database or not using Database.database().reference().child(“users”).hasChild(“somename”)
if it has that some name then i want to write to three different node on firebase i.e at sender node at receiver node and at one more node
i am doing this by calling
Database.database().reference().child(“send).childbyautoid.servalue(somename: somevalue)
Database.database().reference().child(“receiver”).child(“receiverid”).childbyautoid.setvalue(somename: somevalue)
database.database.reference().child(“all”).childbyautoid.setvalue(somename: somevalue)
problem is i am doing it just before closing the view controller
so either i should wait for all of the fire to execute or controller dismisses only after calling one fire
is this a bad design what should i do to close the controller immediately and also get the data at three places on firebase
ios swift firebase-realtime-database database-schema
add a comment
|
Basically I am checking if some data exist in the firebase database or not using Database.database().reference().child(“users”).hasChild(“somename”)
if it has that some name then i want to write to three different node on firebase i.e at sender node at receiver node and at one more node
i am doing this by calling
Database.database().reference().child(“send).childbyautoid.servalue(somename: somevalue)
Database.database().reference().child(“receiver”).child(“receiverid”).childbyautoid.setvalue(somename: somevalue)
database.database.reference().child(“all”).childbyautoid.setvalue(somename: somevalue)
problem is i am doing it just before closing the view controller
so either i should wait for all of the fire to execute or controller dismisses only after calling one fire
is this a bad design what should i do to close the controller immediately and also get the data at three places on firebase
ios swift firebase-realtime-database database-schema
Basically I am checking if some data exist in the firebase database or not using Database.database().reference().child(“users”).hasChild(“somename”)
if it has that some name then i want to write to three different node on firebase i.e at sender node at receiver node and at one more node
i am doing this by calling
Database.database().reference().child(“send).childbyautoid.servalue(somename: somevalue)
Database.database().reference().child(“receiver”).child(“receiverid”).childbyautoid.setvalue(somename: somevalue)
database.database.reference().child(“all”).childbyautoid.setvalue(somename: somevalue)
problem is i am doing it just before closing the view controller
so either i should wait for all of the fire to execute or controller dismisses only after calling one fire
is this a bad design what should i do to close the controller immediately and also get the data at three places on firebase
ios swift firebase-realtime-database database-schema
ios swift firebase-realtime-database database-schema
edited Mar 28 at 12:34
Praveen Matanam
2,2941 gold badge15 silver badges22 bronze badges
2,2941 gold badge15 silver badges22 bronze badges
asked Mar 28 at 12:14
Mohammad YunusMohammad Yunus
1669 bronze badges
1669 bronze badges
add a comment
|
add a comment
|
1 Answer
1
active
oldest
votes
You can perform multiple writes in one go by using a multi-location update. In your code that would look something like this:
let rootRef = Database.database().reference()
let pushId = rootRef.childByAutoId().key
let updatedUserData = [
"send/(pushId)/someName": someValue,
"receiver/(pushId)/someName": someValue,
"receiver/(all)/someName": someValue
]
// Do a deep-path update
rootRef.updateChildValues(updatedUserData, withCompletionBlock: (error, ref) -> Void in
if (error)
print("Error updating data: (error.description)")
)
The completion handler is then also the place where you'd put code that needs to run when the write is done.
Also see:
- The blog post announcing multi-location updates
thanks man it works but there is still delay of a jiffy only if i could do anything about it
– Mohammad Yunus
Mar 29 at 6:42
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55397391%2fhow-to-write-data-on-firebase-at-three-diffrent-node-at-one-without-closing-view%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can perform multiple writes in one go by using a multi-location update. In your code that would look something like this:
let rootRef = Database.database().reference()
let pushId = rootRef.childByAutoId().key
let updatedUserData = [
"send/(pushId)/someName": someValue,
"receiver/(pushId)/someName": someValue,
"receiver/(all)/someName": someValue
]
// Do a deep-path update
rootRef.updateChildValues(updatedUserData, withCompletionBlock: (error, ref) -> Void in
if (error)
print("Error updating data: (error.description)")
)
The completion handler is then also the place where you'd put code that needs to run when the write is done.
Also see:
- The blog post announcing multi-location updates
thanks man it works but there is still delay of a jiffy only if i could do anything about it
– Mohammad Yunus
Mar 29 at 6:42
add a comment
|
You can perform multiple writes in one go by using a multi-location update. In your code that would look something like this:
let rootRef = Database.database().reference()
let pushId = rootRef.childByAutoId().key
let updatedUserData = [
"send/(pushId)/someName": someValue,
"receiver/(pushId)/someName": someValue,
"receiver/(all)/someName": someValue
]
// Do a deep-path update
rootRef.updateChildValues(updatedUserData, withCompletionBlock: (error, ref) -> Void in
if (error)
print("Error updating data: (error.description)")
)
The completion handler is then also the place where you'd put code that needs to run when the write is done.
Also see:
- The blog post announcing multi-location updates
thanks man it works but there is still delay of a jiffy only if i could do anything about it
– Mohammad Yunus
Mar 29 at 6:42
add a comment
|
You can perform multiple writes in one go by using a multi-location update. In your code that would look something like this:
let rootRef = Database.database().reference()
let pushId = rootRef.childByAutoId().key
let updatedUserData = [
"send/(pushId)/someName": someValue,
"receiver/(pushId)/someName": someValue,
"receiver/(all)/someName": someValue
]
// Do a deep-path update
rootRef.updateChildValues(updatedUserData, withCompletionBlock: (error, ref) -> Void in
if (error)
print("Error updating data: (error.description)")
)
The completion handler is then also the place where you'd put code that needs to run when the write is done.
Also see:
- The blog post announcing multi-location updates
You can perform multiple writes in one go by using a multi-location update. In your code that would look something like this:
let rootRef = Database.database().reference()
let pushId = rootRef.childByAutoId().key
let updatedUserData = [
"send/(pushId)/someName": someValue,
"receiver/(pushId)/someName": someValue,
"receiver/(all)/someName": someValue
]
// Do a deep-path update
rootRef.updateChildValues(updatedUserData, withCompletionBlock: (error, ref) -> Void in
if (error)
print("Error updating data: (error.description)")
)
The completion handler is then also the place where you'd put code that needs to run when the write is done.
Also see:
- The blog post announcing multi-location updates
answered Mar 28 at 13:36
Frank van PuffelenFrank van Puffelen
275k37 gold badges448 silver badges468 bronze badges
275k37 gold badges448 silver badges468 bronze badges
thanks man it works but there is still delay of a jiffy only if i could do anything about it
– Mohammad Yunus
Mar 29 at 6:42
add a comment
|
thanks man it works but there is still delay of a jiffy only if i could do anything about it
– Mohammad Yunus
Mar 29 at 6:42
thanks man it works but there is still delay of a jiffy only if i could do anything about it
– Mohammad Yunus
Mar 29 at 6:42
thanks man it works but there is still delay of a jiffy only if i could do anything about it
– Mohammad Yunus
Mar 29 at 6:42
add a comment
|
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55397391%2fhow-to-write-data-on-firebase-at-three-diffrent-node-at-one-without-closing-view%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown