# How to use Firebase in iOS without Get-Taglist-Component?

**URL:** https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992
**Category:** Questions about Thunkable X
**Tags:** firebase, ios, components
**Created:** [March 20, 2018, 4:18pm UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992 "2018-03-20T16:18:57Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)
#### Post date: [March 20, 2018, 4:18pm UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/1 "2018-03-20T16:18:57Z")

</div>

Dear developers and community members,

does anyone has a clue, how to use the firebase for iOS with only the “get key” option?

I have managed to use firebase crossplatform (developer team is totally awesome), but I am struggling with the data structure:  
Let’s say I have a parent node (“shared contacts”) in firebase, which has childkeys with names(key) and numbers(value) (imagine a storage of contacts).

Without a taglist, the iOS app will never know, when a new contact was added by another user or deleted. First I thought of firebase functions to resolve this issue, but it does not like to handle taglists like arrays or lists:

> **[Best Practices: Arrays in Firebase](https://firebase.googleblog.com/2014/04/best-practices-arrays-in-firebase.html)**
>
> The official blog for Firebase, Google's mobile development platform

So my first attempt, to write a taglist with firebase-functions each time data is added to a special key, called “taglist” under the parent node **has failed**.

Currently, I do not see an alternative to add a get-taglist-component by an expert developer @thunkable, @arun, @albert, or anyone out of the community comes up with a really smart idea 🤓 .  
Or has anyone experience in javascript DeltaSnapshot and the ForEach() method, which could maybe be used as a workaround?

Thx for hearing, keep thunking.  
Cheers,  
Use81

---

<div class="post-metadata">

### Author: ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)
#### Post date: [March 20, 2018, 10:31pm UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/2 "2018-03-20T22:31:56Z")

</div>

… little workaround for now (took only half day 😕 )

‘use strict’;

const functions = require(‘firebase-functions’);  
const admin = require(‘firebase-admin’);  
admin.initializeApp(functions.config().firebase);

//do a snapshot of childnodes and store them as a list  
exports.snaptoarray = functions.database.ref(‘testinput/{testkey}’).onWrite(event =\>{

//const keyRef = event.params.testkey;  
const parentRef = event.data.ref.parent;  
const root = event.data.ref.root;

const testoutput = root.child(‘testoutput’).child(‘keylist’);

const listOfItems = [];

parentRef.once(‘value’).then(snap =\> {  
snap.forEach(childSnap =\> {  
const item = childSnap.key;  
listOfItems.push(item);  
console.log('item: ’ + item);  
});  
//return listOfItems;  
}).then(() =\> {  
return testoutput.set(listOfItems);  
});  
});

---

<div class="post-metadata">

### Author: ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)
#### Post date: [May 7, 2018, 6:20pm UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/3 "2018-05-07T18:20:50Z")

</div>

@thunkable  
will it make sense to wait for a firebase get-taglist-component in thunkable ios?

---

<div class="post-metadata">

### Author: ![wei](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/wei/32/26160_2.png) [@wei](https://community.thunkable.com/u/wei)
#### Post date: [May 9, 2018, 10:15pm UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/4 "2018-05-09T22:15:11Z")

</div>

Can try the following? If you set the key to empty, it will call the data change event block whenever there is a chance to the children.

![19%20PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/3/434b85e42d00f801ee383df09cee713755b65f80.png)

---

<div class="post-metadata">

### Author: ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)
#### Post date: [May 10, 2018, 4:10am UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/5 "2018-05-10T04:10:33Z")

</div>

Thank you for this smart idea, it will surely help many folks in the community 👍

Unfortunely it does not solve my problems, because it only triggers, when changes are done and it gives too much information, when children have children and grandchildren.

What I need is like a simple “dir”-command in MS-DOS: just a simple overview of the keys of the children.

My best workaround for now is firebase functions with the Object.keys() command.

You see, I have very special demands when it comes to the firebase component. What else is needed badly (once a taglist is created) is a get-object component, which has a connectable property string -\> to access all the child values for every item in the tag list.

Take your time for priorising, I know you have bunch of other creative stuff in the pipeline (perhaps also an enriched listview-component 😉 )

Cheers, User81

---

<div class="post-metadata">

### Author: ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)
#### Post date: [May 10, 2018, 4:13am UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/6 "2018-05-10T04:13:00Z")

</div>

The workaround firebase function for anyone, who may need it:

exports.CreateTaglist1 = functions.database.ref(‘database\_main/{cityid}’).onWrite(event=\> {  
const city = event.params.cityid;  
const root = event.data.adminRef.root;  
const itemToUpdate = root.child(‘database\_taglist’).child(city);  
const value = event.data.val();  
const tagList = Object.keys(value);

return itemToUpdate.set(tagList).then(() =\> {  
console.log(‘taglist created’);  
});  
});

---

<div class="post-metadata">

### Author: ![wei](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/wei/32/26160_2.png) [@wei](https://community.thunkable.com/u/wei)
#### Post date: [May 10, 2018, 4:29am UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/7 "2018-05-10T04:29:50Z")

</div>

How often do you need the tag list? or what is the use case?

Cheer,  
Wei

---

<div class="post-metadata">

### Author: ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)
#### Post date: [May 10, 2018, 4:45am UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/8 "2018-05-10T04:45:17Z")

</div>

I appreciate your support very much!

My app is like Google Maps for products (user-generated content). I need a tag list every time, a user wants to see which cities have insider tips already. Then every time a user wants to see, which categories are available in this city. And at last, when the user wants to see, which products are declared in a specific category.

/database\_main/

- —city1/
- —city2/
- 
  - —category1/

- 
  - 
    - —product1: value

- 
  - 
    - —product2: value

The only way, this can be done in thunkable iOS is to get the value of the most parent node and then slice the value (nested objects) with a complicated combination of text components in order to get the keys.

Screenshot 1 android,  
Screenshot 2 android,  
Screenshot 3 iOs.

 ![Screenshot_2018-04-30-15-50-57](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/6/b6726e45146e4a7cfe7e6e96d4be9d8bf26c7ab4.png) ![Screenshot_2018-05-01-08-13-32](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/4/6499c7d73cebdc1aea3f6590354530fea000a072.png)  
 ![image2](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/4/c457303f412918eb11244554fd78b69d360b7c27.PNG)

---

<div class="post-metadata">

### Author: ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)
#### Post date: [May 10, 2018, 5:30am UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/9 "2018-05-10T05:30:26Z")

</div>

I will try to make functions in thunkable, which can analyze the JSON after generating the JSON from object…  
that will look like that screenshot, just with while-loop and some more stuff 🤔

 ![Screenshot%20from%202018-05-10%2007-20-59](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/f/4fb0c60a554c9cb60bac8f0eeabfa71343ef782f.png)

Actually, that should be really easy: I just need to analyse the String from index 1 to end of string and look for “{”, “:”, “,” and “}” 😉

BTW: thx for the replace text component in iOS 🤗🤩

---

<div class="post-metadata">

### Author: ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)
#### Post date: [May 10, 2018, 7:01am UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/10 "2018-05-10T07:01:51Z")

</div>

work done: _L’interpréteur de JSON 👌_

 ![Screenshot%20from%202018-05-10%2016-10-01-1](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/1/f14fc711b97a5b28b7ac73b850995131ab159259.png)

---

<div class="post-metadata">

### Author: ![emilio1](https://avatars.discourse-cdn.com/v4/letter/e/919ad9/32.png) [@emilio1](https://community.thunkable.com/u/emilio1)
#### Post date: [October 3, 2018, 12:35pm UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/11 "2018-10-03T12:35:46Z")

</div>

Hi! How did you manage to solve this case? Can you please write an explanation of how you solved it because I have the same problem.

Thank you in advance.

---

<div class="post-metadata">

### Author: ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)
#### Post date: [October 3, 2018, 4:31pm UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/12 "2018-10-03T16:31:52Z")

</div>

the screenshot is the solution. please share your project, if you have trouble

---

<div class="post-metadata">

### Author: ![emilio1](https://avatars.discourse-cdn.com/v4/letter/e/919ad9/32.png) [@emilio1](https://community.thunkable.com/u/emilio1)
#### Post date: [October 4, 2018, 2:52pm UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/13 "2018-10-04T14:52:39Z")

</div>

I am not understanding the logic that’s why i asked. Can you explain how you are using this function in your program? I mean what is the input, what is the output and how can i use the output

---

<div class="post-metadata">

### Author: ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)
#### Post date: [October 4, 2018, 3:50pm UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/14 "2018-10-04T15:50:39Z")

</div>

can you please share an example project which shows your problem?  
its really hard for me to figure out what you are asking for!

please take your time, make a screenshot, explain what you have done to solve your problem…

---

<div class="post-metadata">

### Author: ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)
#### Post date: [October 4, 2018, 3:57pm UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/15 "2018-10-04T15:57:21Z")

</div>

input: parent node from firebase  
output: list of child node keys

do you understand these words?

---

<div class="post-metadata">

### Author: ![emilio1](https://avatars.discourse-cdn.com/v4/letter/e/919ad9/32.png) [@emilio1](https://community.thunkable.com/u/emilio1)
#### Post date: [October 4, 2018, 4:31pm UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/16 "2018-10-04T16:31:58Z")

</div>

![thunk](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/6/768dbe3c343d3e3f22d8e623c481b951c7b72127.png)

I am making an uber like app and in the driver app it will listen to serviceRequests childs and get the location of the user. The problem is how to get a userId that i don’t know yet and i think you had the same problem. Yes, I understand those words. Tell me if I wasn’t clear

---

<div class="post-metadata">

### Author: ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)
#### Post date: [October 4, 2018, 4:34pm UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/17 "2018-10-04T16:34:41Z")

</div>

> [@emilio1](#):
>
> aking an uber like app and in the driver app it will listen to serviceRequests childs and get the location of the user. Yes i understand those words. Tell me if i wasnt cl

thanks,  
I understand.  
from your screenshot I cannot understand where you want to get a taglist from realtime DB (firebase)

---

<div class="post-metadata">

### Author: ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)
#### Post date: [October 4, 2018, 4:41pm UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/19 "2018-10-04T16:41:27Z")

</div>

this thread is all about a taglist.

This thread was opened for everyone, who wants to get a taglist from firebase in thunkable X apps 🙂

---

<div class="post-metadata">

### Author: ![emilio1](https://avatars.discourse-cdn.com/v4/letter/e/919ad9/32.png) [@emilio1](https://community.thunkable.com/u/emilio1)
#### Post date: [October 4, 2018, 4:43pm UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/20 "2018-10-04T16:43:30Z")

</div>

I understand. With taglist you mean in my case, a list of userId’s in serviceRequests. Right?

---

<div class="post-metadata">

### Author: ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)
#### Post date: [October 4, 2018, 4:44pm UTC](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992/21 "2018-10-04T16:44:32Z")

</div>

I think so.

Do you want to get a list from firebase of all userIDs under the node serviceRequests?

[Next page](https://community.thunkable.com/t/how-to-use-firebase-in-ios-without-get-taglist-component/19992.md?page=2)
