luis901101 / zsdk

BSD 3-Clause "New" or "Revised" License
8 stars 15 forks source link

Conflict with other plugins and use_frameworks! on iOS #1

Closed carmas123 closed 2 years ago

carmas123 commented 3 years ago

Hi, I use your lib into my app and it work very good on Android. In iOS I need to use use_frameworks! into Podfile for other plugins that need it. Do you know any way to bypass this problem?

luis901101 commented 3 years ago

Hi, I use your lib into my app and it work very good on Android. In iOS I need to use use_frameworks! into Podfile for other plugins that need it. Do you know any way to bypass this problem?

Hi, I'm not an iOS expert but I think the iOS native implementation of zsdk plugin must be updated with Swift code implementation in order to be used with use_frameworks!; at least the entry point for the plugin where the PluginRegistrar get's called. It should not be too hard to do but I’m currently short of time to dig into that. Anyway PR's are always welcome.

carmas123 commented 3 years ago

Ok @luis901101 in a day I see the code and try to port it into Swift.

johnvuko commented 3 years ago

Hi, you don't need to use swift at all. You just need to use Zebra LinkOS from a Pod (create one yourself or find one already existing).

carmas123 commented 3 years ago

I need this lib only for Android at now and it work very well. But with this problem I cannot recompile my project.

luis901101 commented 3 years ago

Hi, you don't need to use swift at all. You just need to use Zebra LinkOS from a Pod (create one yourself or find one already existing).

Hi @jonathantribouharet thanks for your comment. At the time of writing the plugin there was no Zerba LinkIS Pod available or at least I didn't found it. As I said before I'm not an iOS expert and I don't know how to create a Pod from Zebra static library, so any help with this is more than welcome.

elvissalabarria commented 3 years ago

I am having problems to include the library for ios any solution? When I do the install pod it finds a version of Zsdk (0.0.1) but then it tells me an error related to the architecture

hillzd22 commented 2 years ago

Hi @luis901101. I'm using the plugin but I'm having the same problem that @elvissalabarria commented related to the architecture. Tried with an iPad and simulator but the build fails.

Screen Shot 2022-01-04 at 17 59 25
luis901101 commented 2 years ago

Hi @hillzd22, that problem is related to what @jonathantribouharet indicates in his comment. I have not had time to address this issue, so any PR is welcome.

elvissalabarria commented 2 years ago

friends I wonder if instead of putting the pub of the lib we make the pub be the embedded project within which we need to use the lib and instead of in the pubspec call the internet we call the repository this should not work? @luis901101 @hillzd22

luis901101 commented 2 years ago

friends I wonder if instead of putting the pub of the lib we make the pub be the embedded project within which we need to use the lib and instead of in the pubspec call the internet we call the repository this should not work? @luis901101 @hillzd22

That will not fix anything. The problem is at this plugin iOS pod resolution level which conflicts with the zsdk static lib. Solution should be to update this plugin to use the iOS zsdk lib as a pod dependency.

This plugin works well on iOS if the rest of your project dependencies doesn't use pods, which is almost imposible for most projects. To see the plugin working on iOS you can open the plugin’s example project and test it on iOS.

elvissalabarria commented 2 years ago

check this link https://techdocs.zebra.com/link-os/2-13/ios/content/libToProj.html

I am missing a step because when I put the lib manually in the xcode it works without problem but when I run from the vsc as the dependency is trying to search the internet because I fall into the same dilemma

luis901101 commented 2 years ago

To check the plugin’s functionality on iOS check the example project, and run it from vcs code or android studio or cli, then compare it with your project.

elvissalabarria commented 2 years ago

when I do it that way if it works but I have more dependencies and that is where the conflict comes in

luis901101 commented 2 years ago

when I do it that way if it works but I have more dependencies and that is where the conflict comes in

Exactly, that’s why I mentioned the need to update the plugin’s code to use zsdk lib as a pod not as a static lib which seems to be the source of the problem

elvissalabarria commented 2 years ago

in the same way I have a variant but I can't find how to do it because I'm new to ios and xcode, the idea would be to define it in the "Header Search Path" that instead of looking in the framework pods since it is specific to the zsdk the look in the lib .a that we define it

johnvuko commented 2 years ago

If you can try to create a pod with the vendored_libraries = "the path to the static lib", it should look to something like

Pod::Spec.new do |s|
  s.name             = 'BRLMPrinterKit'
  s.version          = '4.0.2.1'
  s.summary          = "Pod for the BRLMPrinterKit / Brother's printers"
  s.description      = "This project is only a Pod for the Brother SDK v#{s.version}"
  s.homepage         = 'https://github.com/jonathantribouharet/BRLMPrinterKit'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'Jonathan VUKOVICH-TRIBOUHARET' => 'jonathan@eivo.fr' }
  s.source           = { :git => 'https://github.com/jonathantribouharet/BRLMPrinterKit.git', :tag => s.version.to_s }
  s.ios.deployment_target = '9.0'

  s.ios.vendored_libraries = 'lib/zebra_lib.a'

  # you may need theses lines depending of how is build the lib
  s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO' }
  s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
  s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
end

When you touch things like Search Path it's probably you're doing something wrong

luis901101 commented 2 years ago

If you can try to create a pod with the vendored_libraries = "the path to the static lib", it should look to something like

Pod::Spec.new do |s|
  s.name             = 'BRLMPrinterKit'
  s.version          = '4.0.2.1'
  s.summary          = "Pod for the BRLMPrinterKit / Brother's printers"
  s.description      = "This project is only a Pod for the Brother SDK v#{s.version}"
  s.homepage         = 'https://github.com/jonathantribouharet/BRLMPrinterKit'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'Jonathan VUKOVICH-TRIBOUHARET' => 'jonathan@eivo.fr' }
  s.source           = { :git => 'https://github.com/jonathantribouharet/BRLMPrinterKit.git', :tag => s.version.to_s }
  s.ios.deployment_target = '9.0'

  s.ios.vendored_libraries = 'lib/zebra_lib.a'

  # you may need theses lines depending of how is build the lib
  s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO' }
  s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
  s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
end

When you touch things like Search Path it's probably you're doing something wrong

This should be the way... When I have some time I will try this. PR's are welcome.

englschalk commented 2 years ago

Hey, I am new with iOS and not sure if this is the same issue... The library looks really good and I would like to use it, but I cannot get the example project to run with the error 'symbols not found for architecture amd64'...

screenshot_missing_symbols
luis901101 commented 2 years ago

Yeah @englschalk it seems the same issue. If you are running the example project make sure to not upgrade the file_picker: 1.6.3+2 dependency, that is the one that could break the build.

englschalk commented 2 years ago

Ah yes thanks... So in my case the problem was that I didn't have the static library added correctly, now the example project is working... https://techdocs.zebra.com/link-os/2-13/ios/

fernandomoraesvr commented 2 years ago

I was able to run in a project with some podspec mods, i will not open a PR, because example is broken (libzsdk.a conflict in Pod-Runner), i'm out of time rn, but the repository zsdk in my github is working with use_frameworks.

Btw thanks for the package @luis901101 saved me a lot of time and works great.

If nobody takes the task to fix and open the PR, i will do it asap

luis901101 commented 2 years ago

Great @fernandomoraesvr, I will appreciate if you do a PR when you have the time for it, but please include in the PR the fix to the example project, the whole idea is to make the plugin work with with iOS use_frameworks! and example project should show how this work.

luis901101 commented 2 years ago

New version 2.0.2+13 available with a fix for this issue that was resolved in this PR