nat
nat copied to clipboard
Does not work when importing as framework (use_frameworks!)
Hi!
I want to use natjs libs but importing them as a framework (i.e. adding use_framewoks!
in my Podfile). I need this because I am also using a swift library and it is not possible to import a swift static lib and use it in ObjC(*).
I am testing with the device info plugin. To reproduce the issue, just add natjs and nat-device-info
to a new project, and add use_framewoks!
in platforms/ios/Podfile
. The project compiles, but then I get the runtime js error TypeError: undefined is not a function (near '...device.info...'
. Without use_framewoks!
, it works.
Is there a way to make natjs work with use_framewoks!
?
Thanks!
(*)- Actually, I found this workaround but seems too much work or most likely it will not work.
It seems that you didn't install nat plugin correctly, Can you provide your Podfile
content? @tralves
Hi!
I did install the plugin correctly and it does work when I don't add use_frameworks!
, like so:
source '[email protected]/CocoaPods/Specs.git'
platform :ios, '8.0'
#inhibit_all_warnings!
def common
pod 'WeexNatDeviceInfo', '1.0.0'
pod 'WeexSDK', '0.17.0'
...
the problem is that I need to add need use_frameworks!
, like this:
source '[email protected]/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
#inhibit_all_warnings!
def common
pod 'WeexNatDeviceInfo', '1.0.0'
pod 'WeexSDK', '0.17.0'
pod 'WeexPluginLoader'
pod 'SDWebImage', '3.7.5'
pod 'SocketRocket', '0.4.2'
end
target 'WeexDemo' do
common
end
target 'WeexUITestDemo' do
common
end
pre_install do |installer|
def installer.verify_no_static_framework_transitive_dependencies; end
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end
because my project also depends on a swift lib.
Ok, I got it. But I think this is a issue cause by weex plugin loader, to solve this problem, maybe you can try to set the library targets manually in Xcode.
@Acathur you mean like add them without cocoapods? which library?
Ok, I got it. But I think this is a issue cause by weex plugin loader, to solve this problem, maybe you can try to set the library targets manually in Xcode.
I got same problem, You can consider not using WeexPluginLoader,or support !use_framework