Could not build module 'ResponseDetective'
SandeepAggarwal opened this issue · comments
In line
@import ResponseDetective;
I am getting following compile time error in Obj-C for branch feature/swift-3-dev
Could not build module 'ResponseDetective'
How are you adding ResponseDetective to your project?
Using Cocoapods
pod 'ResponseDetective', :git => 'https://github.com/netguru/ResponseDetective.git/' , :branch => 'feature/swift-3-dev'
Does #import <ResponseDetective/ResponseDetective.h>
work?
Yes, #import <ResponseDetective/ResponseDetective.h>
it gets complile but doesn't serve any purpose.
Then I get an error saying
Declaration of 'RDTResponseDetective' must be imported from module 'ResponseDetective.Swift' before it is required
Hence I go with @import ResponseDetective;
Ok, I will take a look at this and try to reproduce.
Same issue here
Same issue when trying to import 0.5 version in Objective-C project
@VladKorzun @jaymathew: Can you paste here the exact error you're seeing?
I've installed ResponseDetective via cocoapods:
pod 'ResponseDetective', '~> 0.5'
Then when I try to import it
@import ResponseDetective;
I get "Could not build module 'ResponseDetective'" error. If I try to import it like
#import <ResponseDetective/ResponseDetective.h>
and try to enable configuration
[RDTResponseDetective enableInConfiguration:configuration];
I get "Declaration of 'RDTResponseDetective' must be imported from module 'ResponseDetective.Swift' before it is required" error
@VladKorzun: Can you also paste the output of xcodebuild -version
?
Xcode 8.2.1
Build version 8C1002
And does your project contain any Swift files or is it Objective-C only? (I'm just trying to reproduce the issue).
Objective-C only
Are you not seeing "Convert to Current Swift Syntax?" dialog after installing ResponseDetective?
Yes! Thank you, I've got it. It was just unclear for me from errors I've got that the issue was caused by unspecified SWIFT_VERSION.
Thanks!
Okay, it seems I identified the issue. TL;DR: Will be fixed in ResponseDetective 1.0.
When integrating with Objective-C-only projects, CocoaPods doesn't know which Swift version to use and doesn't set SWIFT_VERSION
build setting for Swift pods.
Starting with CocoaPods 1.1.0, there is a pushed_with_swift_version
podspec JSON key that CocoaPods uses when installing a pod, but it only works for already pushed versions (and ResponseDetective 0.5 was pushed before that).
In addition, CocoaPods generates its own umbrella header file, ResponseDetective-umbrella.h
, ignoring the already existing ResponseDetective.h
. This causes the error reported by @SandeepAggarwal, because Swift types are not available after importing a non-umbrella header. To fix that, I pushed a custom modulemap
and told CocoaPods to use that.
The two above problems are now fixed and will be included in ResponseDetective 1.0, which will be released today.