我想测试在我的json响应中是否存在一些json密钥,为此我写道:
XCTAssertNotNil(json?["data"], "It seems `data` value has been changed in JSON")
所以,它通过了我的测试。但是我的JSON中没有这样的关键。当我尝试调试并输入:
(lldb) po json!["data"]
它给了我下一个:
warning: Swift error in module MyApp.
Debug info from this module will be unavailable in the debugger.
warning: Swift error in module MyAppTests.
Debug info from this module will be unavailable in the debugger.
error: in auto-import:
failed to get module 'MyAppTests' from AST context:
error: missing required module 'CommonCrypto'
如何解决这个问题并正确测试?