Skip to content
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

Does not work when importing as framework (use_frameworks!) #46

Open
tralves opened this issue Jun 7, 2018 · 5 comments
Open

Does not work when importing as framework (use_frameworks!) #46

tralves opened this issue Jun 7, 2018 · 5 comments

Comments

@tralves
Copy link

tralves commented Jun 7, 2018

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.

@acathur
Copy link
Member

acathur commented Jun 7, 2018

It seems that you didn't install nat plugin correctly, Can you provide your Podfile content? @tralves

@tralves
Copy link
Author

tralves commented Jun 7, 2018

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.

@acathur
Copy link
Member

acathur commented Jun 7, 2018

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.

@tralves
Copy link
Author

tralves commented Jun 13, 2018

@acathur you mean like add them without cocoapods? which library?

@Zss1990
Copy link

Zss1990 commented Jul 30, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants