Swift error when trying to access Dictionary: `Could not find member 'subscript'`

后端 未结 4 901
半阙折子戏
半阙折子戏 2021-02-04 08:08

This won\'t compile: \"enter I\'ve tried a couple different things; different ways of declaring th

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-04 08:29

    You can get nested dictionary data by following these steps:

    let imageData: NSDictionary = userInfo["picture"]?["data"]? as NSDictionary
    let profilePic = imageData["url"] as? String
    

提交回复
热议问题