And finally, when it is restarted, your app needs to detect that it has been called back, and extract the barcode information from the callback URL. That is done by defining the handleOpenURL() method of the App Delegate:
The part after "callback=" is the (escaped) URL that pic2shop will use to call back your app. You can change it, but you need to keep the "EAN" string somewhere, because pic2shop will replace it with the barcode digits.
Web developers, the above link is all you have to do to integrate barcode scanning in your site. In your case, the callback will be a regular URL pointing to your web app.
For the callback to work, your app needs to have registered its own URL scheme with the iPhone OS. For that, it needs to add an entry in its own Info.plist (we use the p2sclient: scheme in this example):
Web developers, the above link is all you have to do to integrate barcode scanning in your site. In your case, the callback will be a regular URL pointing to your web app.
For the callback to work, your app needs to have registered its own URL scheme with the iPhone OS. For that, it needs to add an entry in its own Info.plist (we use the p2sclient: scheme in this example):
Below, we describe how to implement the third option. Web developers, you can use the same method to barcode-enable your site, so read on!
This method requires that your users install pic2shop. However, pic2shop is, and will remain, free, so it does not cost you or your users anything. Moreover, pic2shop is lightweight (less than 400k), and loads very fast.
The complete Xcode project is available for download here. Feel free to reuse the code samples and distribute them widely.
To start, the client app (your app) needs to check whether pic2shop is already installed:
This method requires that your users install pic2shop. However, pic2shop is, and will remain, free, so it does not cost you or your users anything. Moreover, pic2shop is lightweight (less than 400k), and loads very fast.
The complete Xcode project is available for download here. Feel free to reuse the code samples and distribute them widely.
To start, the client app (your app) needs to check whether pic2shop is already installed:
If you are an iPhone developer who needs to incorporate barcode scanning into your app, you have three possibilities:
NSURL *urlapp = [NSURL URLWithString:
@"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=308740640&mt=8"];
[[UIApplication sharedApplication] openURL:urlapp];
@"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=308740640&mt=8"];
[[UIApplication sharedApplication] openURL:urlapp];
1. You develop your own barcode reader. Open source libraries like zxing are a great start, but they will not work on the iPhone 3G, still the most common iPhone out there. Most commercial libraries have the same limitation.
2. You license the pic2shop barcode scanner library and SDK. We spent hundreds of hours to make it work quickly and accurately on all iPhone models. Get more information from Vision Smarts' web site.
3. You take advantage of the pic2shop: custom URL scheme to launch pic2shop, read the barcode, and get the barcode digits back in your app, for free.
2. You license the pic2shop barcode scanner library and SDK. We spent hundreds of hours to make it work quickly and accurately on all iPhone models. Get more information from Vision Smarts' web site.
3. You take advantage of the pic2shop: custom URL scheme to launch pic2shop, read the barcode, and get the barcode digits back in your app, for free.
In this simple example, the barcode is the "host" part of the URL, right after the double slash.
That's it! Have a lot of fun with barcodes! We would love to hear about the apps that you build using this system.
pic2shop is developed by Vision Smarts. For more information, visit our web site at www.visionsmarts.com.
That's it! Have a lot of fun with barcodes! We would love to hear about the apps that you build using this system.
pic2shop is developed by Vision Smarts. For more information, visit our web site at www.visionsmarts.com.
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
NSLog(@"got barcode: %@", [url host]);
}
NSLog(@"got barcode: %@", [url host]);
}
if ([[UIApplication sharedApplication]
canOpenURL:[NSURL URLWithString:@"pic2shop:"]]) {
canOpenURL:[NSURL URLWithString:@"pic2shop:"]]) {
We use the result to show or hide the buttons that offer to install pic2shop or to scan a barcode.
To take the user to the pic2shop install page do:
To take the user to the pic2shop install page do:
To start pic2shop, and tell it to call back the client app with the barcode (your app will exit at this point !):
NSURL *urlp2s = [NSURL URLWithString:
@"pic2shop://scan?callback=p2sclient%3A//EAN"];
[[UIApplication sharedApplication] openURL:urlp2s];
@"pic2shop://scan?callback=p2sclient%3A//EAN"];
[[UIApplication sharedApplication] openURL:urlp2s];

Make your web site or iPhone app scan barcodes for free!
Quick links:
- Web developers, try our online demo
- App developers, download the complete Xcode project
- Web developers, try our online demo
- App developers, download the complete Xcode project