Swift 2.0: Could not cast value MyApp.MyCustomClass to MyAppTests.MyCustomClass when using Set

后端 未结 1 731
醉酒成梦
醉酒成梦 2020-12-15 03:35

This is an error:

Could not cast value of type MyApp.Member (0x1674daf8) to MyAppTests.Member (0x4c07248).

相关标签:
1条回答
  • 2020-12-15 04:22

    I have found a solution:

    I suppose that those who has such problem, imported their files into test target this way:

    Since they should do it just like this:

    So, just remove the files from your test target. And then if you need your files within test target just use @testable keyword within your every test class.

    This way there is no problem with casting values between targets anymore. It worked for me:-) Enjoy:-)

    Read more from Swift 2 + Xcode 7: Unit Testing Access Made Easy!!!!

    0 讨论(0)
提交回复
热议问题