Test bundle could not be loaded because an unanticipated error Test bundle could not be loaded because an unanticipated error ios ios

Test bundle could not be loaded because an unanticipated error


If other readers are getting this error, and you're using Carthage to add a framework, ensure the Copy Files phase is with Destination: Frameworks.

Adding frameworks from Carthage

If you accidentally add the frameworks to a Copy Files phase with a different target (other than Frameworks), or Copy Bundle Resources, this will also produce the damaged / invalid bundle error message.


I had a similar problem. For me, the problem was a unit testing framework that was a dynamic framework but not copied over to the xctest bundle.

The solution was to add a "Copy Files" phase to my unit test target, set its destination to "Frameworks" and add my framework as an input file.


I was able to resolve this issue by setting the host application for the test target:Host Application


matomo