CKError localizedDescription

后端 未结 2 1830
醉话见心
醉话见心 2021-01-18 05:50

Aim

  • I would like to display the CKError encountered to the user in the app as an alert.
  • So I would like to extract the string from the
2条回答
  •  南方客
    南方客 (楼主)
    2021-01-18 06:43

    The error.localizedDescription is really all you have to work with from the error itself.

    Your app can provide a better error message (more user-friendly, localized, etc.) by checking for the error code and providing its own message to the user.

    (error as? NSError)?.code
    

提交回复
热议问题