-
Notifications
You must be signed in to change notification settings - Fork 33
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
iOS support #7
Comments
Sweet, I would really love to! Unfortunately I don't have any experience with iOS. If you know a legal and easy way for me to give it a try in a Virtual Machine that would be great. Regarding garden.zbarcam, please take play on the latest |
I've got a Mac OSX system up and running that can build kivy iOS apps and I'm willing to do a lot of the leg work. I just need some guidance on how to build the recipes. I'm not sure how much different it is between iOS and android recipes. I'm starting right now with the libiconv recipe. The iOS recipe support is pretty sparse... |
OK, I believe you can take a look at existing p4a recipe to get some inspiration, since both iOS and Android recipes look very similar. Be ready to spend time on it at first because it ain't easy at the beginning. You can also get some support on For p4a I found a way to automate build in a continuous integration. If you make this somehow that would be awesome and help the kivy-ios project. Good luck! 😃 |
Well I got lucky with libiconv. I merged some of the python 4 android and the basic build_arch function of some ios recipes and it compiled the library. Moving onto libzbar now. Thanks for the advice. |
Well done, by the way that's something I think https://github.com/kivy/kivy-ios project or even just https://github.com/kivy could improve. That would be great if we could by default inherit p4a recipes and eventually update with few tweaks when needed. Because last time I checked the code base, it looked very similar. |
Is zbarlight currently working? I've got libiconv and libzbar recipes working I think for kivy-ios. Up next is the zbarlight module but I want to make sure its work before I trudge through the next recipe. |
So far with the zbarlight recipe I'm coming across this error.
And my recipe is of right now is import os
from toolchain import PythonRecipe,shprint
from os.path import join
import sh
class ZbarLightRecipe(PythonRecipe):
version = '1.2'
url = 'https://github.com/Polyconseil/zbarlight/archive/{version}.tar.gz'
depends = ['python', 'host_setuptools', 'libzbar']
pbx_libraries = ["libz","libbz2"]
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
hostpython = sh.Command(self.ctx.hostpython)
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['CFLAGS'] += ' -I' + join(self.ctx.dist_dir,'include', arch.arch,'libzbar')
build_env['CFLAGS'] += ' -I' + join(self.ctx.dist_dir,'include', arch.arch,'libzbar','zbar')
build_env['LDFLAGS'] += " -lios -lpython -lzbar"
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
recipe = ZbarLightRecipe() Edit: Added full log and reformatted code |
Well done for your progress so far!
Yes it's working and it's maintained so it should be the preferred library over zbar. Regarding your error I have few questions.
|
|
OK I see. And thanks for editing the trace with formatting. So yes that line confirms my doubts:
You should definitely not use your hostpython since it's supposed to be cross compiled. |
|
|
So I've changed my code to mimic the kivy ios pil library like this
And got this log
|
Continued
It doesn't crash and this line seems troubling.
My kivy site-packages does have the zbar egg file but no zbar package which I think is due to the issue above. |
So I was looking at my anaconda site packages and the only thing that shows up there for zbar is zbar.so and I looked at zbarlight and the only thing that showed up for it was zbarlight/_zbarlight.so and zbarlight/_zbarlight.c I was expecting something else I think but I think all thats produced is a zbar.so file. I might actually be done with the recipes! |
Alright I think I've finished the recipe section. I looked at PIL and it also had .so files but theose |
I think I'm finally done now! I explored pil and zbar in my anacondas site-packages and things started making more sense. After the zbar or pil is extracted you need to run the build command on them to to get all the .o .so and .so.libs files. Once you have those you link all the .so.libs together to get a fat .a file with all the archs in it. I'm not 100% sure but this is what pil seems to be doing and I've updated my zbarlight recipe as follows.
|
How is it going @GoBig87 ? Could you share your progress or even some of your code. Perhaps we can already host some of your recipes in the repository, even though it's in on-going status? |
Alright status update. After tons of patches and recipe creations I've got the app to load and the camera widget to pop up but unfortunately its just a black screen at the moment. I'm making progress but every hurdle I clear another pops up in front of it. Ive applied a lot of patches from all over the place. I might need to just make a kivy-ios branch with all the changes that need to be implemented to get this to work. |
Awesome, nice progress! I would really love to help here. But I don't have anything to develop/test on iOS. I wish I could easily on Linux. |
Here's the xcode log, not much there
And I've only been running the app through an iphone 6s, not the emulator yet. |
Just got done running it on my iphone simulator which is all black too. Maybe somethings wrong with xcamera's code or kivy's camera widget. I had zbarcam working on my macbook which should utilize AVfoundation as the camera source. So that works on macs OSX but not on iOS for some reason... |
Great, yes regarding the provider, this is exactly what I wanted to check. I didn't know it was called Oh wait, I found the upstream issue :) |
I've went through that issue and this issue kivy/kivy#5273. Making a patch with the suggested fix in 5273 didn't fix it. I've also set the KIVY_GLES_LIMITS=0 too. |
Agr annoying then, try asking for some support there too. At least say on |
I've also tried just loading a plain Camera widget from kivy instead of the zbar camera and it's still black so the issue is before the xcamera or zbar. |
Yes clearly is an upstream issue. |
I've got the camera working now! I had to set the values to 'rbga' not 'bgra' with my patch
And it picked up the QR code too! |
Oh man congrats, I'm very happy to ear. You were very tenacious, that's the good attitude, Kivy is quite experimental, specially on smart devices, but you made it, well done! |
I used buildozer to build my ios packages but I would also use ./toolchain.py to clean and rebuild recipes. Buildozer right now has some hiccups with OSX/ios. You have to run buildozer, it fails, then run ./toolchain.py build hostpython and after that you can then build recipes. Then it will fail because you need to add your devolper ID in xcode. Then it fails because you need to link some binaries (libc++, libsqlite3, libbz... ect). Then you need to also turn bit code off... But after all that it will build your project! So with my recipes and patches right now buildozer can run no problem once I get it all tweaked properly. I'll clean some stuff up and work on making some pull requests tonight. The code works right now but there's still some issues that need to be cleaned up in the xcamera like auto focus and force orientation for ios. But overall functionality is working now. |
OK I understand for buildozer on OSX/iOS still has a long road to go :) |
Alright got a pull request thats up kivy/kivy-ios#289. And here's a gif of it in action...ish https://imgur.com/a/wUxxGIZ. My app is supposed to unlock a bluetooth padlock once it scans the barcode but thats not working yet for iOS so it crashes once it picks up a valid bar code.
The zbarcam was definitely a good learning experience that I'm going to need to incorporate the bluetooth lock (and stripe too...)into my app. From the wasteland thats kivy-ios looks like it will be quite lonely for help. |
I don't get it. How is this supposed to work exactly, given pyzbar uses EDIT: Possibly EDIT2: Aaaaaaaaaaaaaaaaaaaaah. EDIT3: I guess I'll fork this and revert to zbarlight... Or yet better, make it so that EDIT4: See #42 for the "available implementation picker" thingy. Hopefully someone gets use out of it. :-) |
Hi guys, We're now able to natively scan QRCodes (and with some minor changes also all the machine readable codes mentioned over here: https://developer.apple.com/documentation/avfoundation/avmetadatamachinereadablecodeobject/machine-readable_object_types?language=objc) The changes that are been recently merged into Kivy master: I did a test on reading a QRCode and works a far better than his zbar-powered counterpart on Android. How it sounds to you guys about creating some sort of I was thinking to do that directly into |
Sounds like a good idea. How about trying that in a dedicated (from scratch) garden library? |
IMHO it's not sensible unless we get an Android equivalent?
|
ZBARCAM is still not working on IOS !! been going through every thing on this issue, and none of the mentioned actually works; if not, is there any replacement IOS barcode scanner to use ? |
If you want to check out a more native barcode scanner you can use this https://github.com/psychowasp/KivySwiftLink. I’ve seen some camera work that’s been implemented with using this tool and it handles >1080p video flawlessly. It might be a little more work but it will work way better. You’ll have to implement the bar code scanner in swift but you can then import and use it in kivy. I used the zbar camera for an iOS app and it was pretty clunky but did work. This new method for interacting with swift is MUCH faster. |
HI GoBig87, thank you for your response I've been following your work, and it seems that you got ZBARCAM working on IOS, but the link you posted for the build is expired. |
Use this tag as it still uses zbarlight https://github.com/kivy-garden/zbarcam/tree/2019.0222. The frame rate was just really slow and starting and stop the camera was pretty resource intensive. It picked up barcodes like a champ though! If the kivy-ios recipes in there work for you then great but if its a head ache I would highly recommend trying out the KivySwiftLink by @psychowasp |
no matter what i do, zbaram 2019.0222 wouldn't install; it gives me long list of errors, that summerized with a missing file, which is zbar.h. i did install zbar, which seems a very strange issue. i'm using latest kivy master; should also go back to kivy 1.10.1 !! |
still looking |
Oh thats right, hold on you need to manually copy the zbar.h file over somewhere. Inside of or your kivy-ios build folder copy zbar.h to |
Hello. Has anyone done this (use qr scanner in iPhone)? If yes, give example. Thank you so much. |
https://github.com/kivy/kivy/blob/01049a8f4536f42a5129e62863053c1a274e8665/kivy/core/camera/camera_avfoundation.pyx#L158 just call |
Currently iOS is missing some recipes that zbar cam needs in order to work for iOS. I'm working on making a recipe but I have never made a kivy recipe before so it might take me a bit to figure out. Any help with recipes would be appreciated!
The text was updated successfully, but these errors were encountered: