Ios 值是可选的(“myvalue”),如何只获取值而不获取可选值

Ios 值是可选的(“myvalue”),如何只获取值而不获取可选值,ios,swift,console,Ios,Swift,Console,当值作为可选值MyValue出现时,我得到的是我的值,但是如果没有可选值,我怎么能只得到值呢。我已经尝试了很多,但没有得到的要点,任何帮助将被高度赞赏。问题是,我使用Firebase作为数据库,并在数据库中获取值 我想知道性别、血统和国家代码的价值 火基连接性 其他代码 控制台 试试这个: 打印对象 及 请写信 if tableView == tableViewB { let cell = tableViewB.dequeueReusableCell(withIdentifier:

当值作为可选值MyValue出现时,我得到的是我的值,但是如果没有可选值,我怎么能只得到值呢。我已经尝试了很多,但没有得到的要点,任何帮助将被高度赞赏。问题是,我使用Firebase作为数据库,并在数据库中获取值

我想知道性别、血统和国家代码的价值

火基连接性

其他代码

控制台

试试这个:

打印对象

请写信

if tableView == tableViewB {

    let cell = tableViewB.dequeueReusableCell(withIdentifier: "blood", for: indexPath)
    cell.textLabel!.text = dropDownList[indexPath.row] as! String
    return cell

}
而不是

if tableView == tableViewB {

    let cell = tableViewB.dequeueReusableCell(withIdentifier: "blood", for: indexPath)
    cell.textLabel!.text = dropDownList[indexPath.row] 
    return cell

}

在表格视图中,cellForRowAt方法。

可以指定哪个值?选项是Swift的关键功能。它们在Swift电子书中有解释。如果你想学Swift,你就不能不学这个。谢谢@EricAya我正试图关注这些概念,但仍在尝试…………我更新了问题请参见firebase连接代码PLZ请参见firebase连接的更新代码,当要求删除时,它警告我删除???在您建议的行中,我建议打印标签和为标签赋值。让我们来看看。
   com.apple.MobileAsset.TextInput.SpellChecker
   Optional("male")
   Optional("A+")
   <UIImage: 0x600000295950>, {96, 64}Optional("+92")
   fatal error: unexpectedly found nil while unwrapping an Optional value
print(bloodGroup ?? "")
cell.textLabel!.text = (dropDownList[indexPath.row] ?? "")
if tableView == tableViewB {

    let cell = tableViewB.dequeueReusableCell(withIdentifier: "blood", for: indexPath)
    cell.textLabel!.text = dropDownList[indexPath.row] as! String
    return cell

}
if tableView == tableViewB {

    let cell = tableViewB.dequeueReusableCell(withIdentifier: "blood", for: indexPath)
    cell.textLabel!.text = dropDownList[indexPath.row] 
    return cell

}