问题描述
我正在尝试从Firebase数据集中找到特定的用户图像,我正在将具有唯一显示名称的组用户命名为孩子,并使用名称,lowerCaseName,UID和Image的键来命名那些孩子.
I'm trying to find specific user images from my Firebase data set I'm naming the group users with unique display names as children and those children with keys of name, lowerCaseName, UID, and Image.
无论如何,我是否可以将用户作为变量查询以获取图像?我在考虑 http://firebase.com/users/%diplaynames/image 但没有把握.
Is there anyway I can query through users as a variable in order to get to images?? I'm thinking http://firebase.com/users/%diplaynames/image but not sure.
推荐答案
您的Firebase基本URL是什么?您应该查询的路径类似于:
What is your Firebase base url? You should be querying the path that looks something like:
https://<APP ID HERE>.firebaseio.com/
因此,您正在初始化Firebase的样子:
So you're initialization of Firebase should look like:
let fire = Firebase(url: "https://<APP ID HERE>.firebaseio.com/users/<DISPLAYNAME>/image")
或者,您可以执行以下操作:
Alternatively, you could do:
let fire = Firebase(url: "https://<APP ID HERE>.firebaseio.com")
let imageRef = fire.childByAppendingPath("users").childByAppendingPath("<DISPLAYNAME>).childByAppendingPath("image")
这篇关于在Swift中使用变量进行Firebase查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!