New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-3381] Test-Swift.h tries to import app as module, fails #45969
Comments
@swift-ci create |
Comment by Andria Jensen (JIRA) I'm also seeing this same problem. |
Can one of you attach a sample project that demonstrates the problem? |
It's pretty easy to set up: an application target with Swift in it, then a mixed-source unit test target where one of the .m files imports the generated header for the test target. One of the test source files should have an ObjC-compatible method that uses one of the app target's types. |
Comment by Oleg Kokhtenko (JIRA) @bob-wilson here you go a simple example. It has the same result in Xcode 8.3.3 and Xcode 9.0 as well. Also, I believe that I described work around for this issue in this stackoverflow answer untill this issue is fixed. |
Comment by Andria Jensen (JIRA) @bob-wilson We've just figured out a solution to this issue for our project. It's documented in the article here: https://medium.com/if-let-swift-programming/ios-tests-working-with-objective-c-and-swift-class-together-aaf40f91a27c Specifically, the last part of the article. I added `$CONFIGURATION_TEMP_DIR/{ProjectName}.build/DerivedSources` to the `Header Search Paths` and now our Swift.h file is recognized and importing correctly for all of our unit tests. Hopefully this helps resolve this issue. cc kohtenko (JIRA User) |
That is a different problem, sorry. That only works if the Swift classes in the test target don't depend on Swift classes in your app target. |
Something that might work: having PrintAsObjC call |
Comment by Aaron L'Heureux (JIRA) Glad to see some activity on this - we're encountering this and it's a significant sore spot integrating new Swift code that we really want to write into existing Objective-C tests. |
Attachment: Download
Environment
I'm using Xcode 8.1 with Swift 3.
I also found this issue reported a year ago on StackOverflow, tagged Swift 2 and Xcode 7, so it's not new.
http://stackoverflow.com/questions/33688767/module-myapp-not-found-in-unittest-swift
Additional Detail from JIRA
md5: a66a2afe2a9be2729702bd352c3e6556
Issue Description:
In my Xcode test target, the Test-Swift.h file includes the line "@import MyApp" which yields a "Module 'MyApp' not found" error.
The text was updated successfully, but these errors were encountered: