Barcode Scanning / iOS

Is there any support for scanning barcodes using the camera and Xojo iOS?

on release date?
and without a plugin SDK?
I think you have to wait a few months.

That’s fair. I was being hopeful. Any projections for the plugin SDK? Cordova or Phonegap support?


  • no plans
  • no plugin SDK
  • no way to link in static or dynamic lib or frameworks.

and I’m not going to write my own barcode scanner in pure Xojo code.

[quote=149900:@Christian Schmitz]today:

  • no plans
  • no plugin SDK
  • no way to link in static or dynamic lib or frameworks.

and I’m not going to write my own barcode scanner in pure Xojo code.[/quote]

But you will use declare for camera access, right, since there is no support for it in the current version ?

you can go to camera with declares.

That is what I thought. Not exactly pure Xojo code, then. Easy for you, difficult for most others, especially for peripherals as complex as the camera.

I’m going to see what I can do about this through declares. It will take me a few hours though since I’m working on some other stuff right now. I’ll post back when I make some progress.

So this took a lot longer than expected, but I now have a camera class created to access the iPhone camera. I encountered a strange bug where the camera view could not be successfully presented twice, but I think I have worked around that by creating a new camera object each time. Unfortunately I have not been able to test whether it successfully takes a picture using the iPhone camera because that requires that the app be deployed to a device and I don’t have a iOS license yet, however it does work for selecting images from the photo library on the simulator. If someone can test it on an actual device to confirm that it works to take pictures that would be good :slight_smile:
The only change you will need to test the camera is to change the line:

SourceType = UIImagePickerController.Source.PhotoLibrary

in the MainView open event to:

SourceType = UIImagePickerController.Source.Camera

Now I just need to add some extra error checking for the cases where a user did not allow camera access as it currently doesn’t check that an report an error. I will do so in the coming days.

Demo project:

That’s cool! It would be great if someone that can deploy to an actual device to make sure it works :slight_smile:

It works perfectly on the device. The only thing I had to do is to scale the photo in Canvas1 Paint, as it was showing only a small portion.

Congratulations, Jason ! And thank you so much from the community. All these declares should challenge the Xojo team into making a dynamite 2015 R1 :wink:

I agree! Thank you jason!

I’m glad. Thanks for testing!

I hope so!

You’re welcome!

Is it possible to read a QRCode with that solution ?

The app does take pictures quite fine, and creates iOSImages.

Now to read a QR code, you got to analyse the picture, and that’s when it becomes a whole different issue. From what I read at QR code - Wikipedia it looks a bit daunting.

CGImage has a function to read QRCode (if I am not mistaken).

I see this :

Not really sure how to use !!

This won’t be possible with AVFoundation in Xojo without a plugin because it would require Xojo code to be run in an thread not managed by the Xojo runtime which causes all kinds of problems. I think it can be done with CoreImage though. Let me look into this a bit.

Give this a look, may or may not be what you’re looking for.

I’ve used their classes to create DataMatrix codes, haven’t tried reading them yet

Here is an implementation using CoreImage. From what I was reading, it will only function on a physical device and my tests indicate the same since a CIDetector cannot be created in the simulator. If someone can test it and let me know if it works since I don’t yet have an iOS license that would be great.

Edit: Link was wrong.