Getting Optional(“”) when trying to get value from KeyChain

后端 未结 5 1436
自闭症患者
自闭症患者 2020-12-15 23:00

When I try to get my keyChain value, it return a string containing:

Optional(\"[thing in the KeyChain]\")

so, I tried to remove \"Optiona

5条回答
  •  春和景丽
    2020-12-15 23:15

    You actually don't even need to do anything. The "Optional" string isn't in the actual data. That is just something Swift seems to place on the output on the console when it is an optional value that isn't unwrapped. IE The data itself doesn't contain the string Optional.

    Still, good to unwrap it if you know it contains data.

提交回复
热议问题