ios - Firebase Saving Data Methods Asynchronous or Synchronous -


are firebase saving data methods such childbyautoid , updatechildvalues asynchronous or synchronous? there seems no place pass in completion handler i'm guessing synchronous i'm not sure because seems little weird (for performance purposes) firebase make such commonly needed methods synchronous.

as of modern web, interacting firebase database asynchronous operation. that's why methods in firebase database api can take completion block.

for write operations block optional, because there cases when may not want specify completion block.

for example, here's api reference doc updatechildvalues:withcompletionblock:

updatechildvalues:withcompletionblock:

swift

func updatechildvalues(values: [nsobject : anyobject], withcompletionblock block: (nserror?, firdatabasereference) -> void)

parameters

values - dictionary of keys change , new values

block - block triggered after update has been written on firebase database servers

the childbyautoid method client-side operation; not need interact firebase servers, 1 of reasons can run when user not connected database. since doesn't need interact server, synchronous , return reference new location, guaranteed unique. if want learn more keys generated childbyautoid, read blog post the 2^120 ways ensure unique identifiers.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -