在多维Swift数组中访问值?

时间:2016-06-10 19:53:59

标签: ios arrays swift firebase swift2

我想使用Firebase查询的结果填充tableView。我成功地获得了结果并将它们存储到一个数组中,但我正在努力将这些值放到表中。

我正在找回“userID”和“title”。我将它们存储在数组(virtualenv) VirtualBox:# django-admin makemigrations Traceback (most recent call last): File "/usr/share/django-apps/virtualenv/bin/django-admin", line 11, in <module> sys.exit(execute_from_command_line()) File "/usr/share/django-apps/virtualenv/lib/python3.4/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line utility.execute() File "/usr/share/django-apps/virtualenv/lib/python3.4/site-packages/django/core/management/__init__.py", line 303, in execute settings.INSTALLED_APPS File "/usr/share/django-apps/virtualenv/lib/python3.4/site-packages/django/conf/__init__.py", line 48, in __getattr__ self._setup(name) File "/usr/share/django-apps/virtualenv/lib/python3.4/site-packages/django/conf/__init__.py", line 44, in _setup self._wrapped = Settings(settings_module) File "/usr/share/django-apps/virtualenv/lib/python3.4/site-packages/django/conf/__init__.py", line 92, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/share/django-apps/virtualenv/lib/python3.4/importlib/__init__.py", line 109, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 2254, in _gcd_import File "<frozen importlib._bootstrap>", line 2237, in _find_and_load File "<frozen importlib._bootstrap>", line 2212, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 2254, in _gcd_import File "<frozen importlib._bootstrap>", line 2237, in _find_and_load File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked ImportError: No module named 'mysite' 中。获取值后的数组示例为[[String]]

我如何访问单个值,例如userID?这是我目前在我的cellForRowAtIndexPath函数中所拥有的:

[["OYa7U5skUfTqaGBeOOplRLMvvFp1", "manager"],["JQ44skOblqaGBe98ll5FvXzZad", "employee"]]

谢谢!

编辑:添加了在数组中存储快照的功能

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath)
        let invite = inviteArray[indexPath.row]
        print(inviteArray)
        print(invite)

        return cell
    }

0 个答案:

没有答案