mokagio mokagio - 26 days ago 14
Swift Question

Opening import file for module 'XCTest': Not a directory

I'm experiencing this issue on a brand new Sierra setup, with Xcode 8.1.

I have a framework target for iOS, the target builds fine, but when I try to build for test the build fails with this error:

Opening import file for module 'XCTest': Not a directory


enter image description here

I looked at these questions already, but their suggestions are not useful for us:



All the settings in the project are pretty standard.

Answer

The cause of this issue was quite bizarre.

It was happening in a CI box on which I had installed Xcode 8.1 via the MAS. In our company we provision CI boxes using xcode-install, but for some reason that I don't remember I wasn't able to do so on this one.

To mimic xcode-install's behaviour I renamed Xcode.app into Xcode-8.1.app, and created an alias of it called Xcode.app.

This is where the issue was. The alias I created wasn't a proper symbolic link. Xcode.app wasn't actually a folder.

I realised this when trying to perform a command line build that referenced some system framework other than Foundation/UIKit... It failed saying that it couldn't find the framework inside Xcode.app/....

Once I made Xcode.app into a proper symlink everything worked.