You no longer need to import the application module into unit tests after changing the deployment target

For unit testing public classes for my main application goal in my quick unit tests, I have to import my main application module into my tests as follows:

#import MyAppModuleName

This worked fine until I changed the deployment target from 7.0 to 8.4.

Now creating and running my application still works fine, but the unit tests that have run have stopped working. The compiler complains about the above import statement: Swift Compiler Error: Module file minimum deployment target is iOS8.4 v8.4

I do not know why. I forgot to change the deployment target somewhere else?

My workspace (Xcode 6.4.) Contains my own project and the Pods project (auto-generated cocoapods). I use Swift and Objective-C in my application and in my tests.

Here is what I did in more detail:

1) The deployment target has been changed from 7.0 to 8.4 for my project, my main goal, and also for the Pods project in my workspace and all targets.

enter image description hereenter image description hereenter image description hereenter image description here

2) Cleared the build folder (Shift + Alt + Cmd + K) and restarted Xcode.

3) Cmd + U → Error

If you change the main goal of deploying the application to 7.0, everything works fine again.

Any ideas this issue comes from?

+8
ios unit-testing xcode swift build-settings
source share
1 answer

You were almost there, you just need to update the iOS deployment target for your project and both of your goals.

For your project: enter image description here

For the target purpose of your application: enter image description here

For your test purpose: enter image description here

You should probably do a clean and rebuild, no need to restart Xcode. I think this will also work if you want to target 8.1, etc.

+16
source share

All Articles