Barcodes with iOS
eBook - ePub

Barcodes with iOS

Bringing together the digital and physical worlds

Oliver Drobnik

Partager le livre
  1. 248 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Barcodes with iOS

Bringing together the digital and physical worlds

Oliver Drobnik

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

Summary Barcodes with iOS is the first and only book that comprehensively addresses barcode technology for the iOS developer. It offers an introduction to commonly used formats, such as ISBN and UPC codes, and provides real-world examples that teach you how to integrate code scanning and generation into your apps. This book consolidates information about applicable Apple frameworks in one place so you can quickly add native barcode support to your existing enterprise apps or start building new apps that help bring together the physical and digital worlds.Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications. About the Technology Barcodes are a universal way to track and share information, appearing on everything from cereal boxes to shop windows. Starting with iOS 7, Apple has added native features for building apps that scan, display, and print barcodes, eliminating the need for third-party libraries. About the Book Barcodes with iOS teaches you how to effectively use barcodes in your iOS apps. You'll master Apple's new barcode frameworks while you explore real-world examples that integrate code scanning and generation and metadata retrieval into your apps. Along the way, you'll pick up numerous best practices for bringing together the physical and digital worlds.This book is written for readers with a working knowledge of Objective-C and iOS app development. What's Inside

  • Learn about all barcode formats supported by iOS
  • Native barcode scanning with AV Foundation
  • Using Core Image and BarCodeKit to produce a wide range of barcodes
  • Printing to sheets and labels with AirPrint
  • Retrieving metadata for products with NSURLSession and NSURLProtocol
  • Harnessing context information from Core Location and iBeacons


About the Author Oliver Drobnik is an independent consultant specializing in custom iOS and Mac development. Table of Contents

  • Barcodes, iOS, and you 1
  • Media capture with AV Foundation 18
  • Scanning barcodes 48
  • Passbook, Apple's digital wallet 70
  • Generating barcodes 97
  • Getting metadata for barcodes 133
  • Putting barcodes in context 172

  • Appendices
  • History of the UPC 205
  • GTIN prefix ranges 212
  • GS1-128 application identifiers 217

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Barcodes with iOS est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Barcodes with iOS par Oliver Drobnik en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Informatique et Programmation d'appareils mobiles. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Éditeur
Manning
Année
2015
ISBN
9781638353270

Chapter 1. Barcodes, iOS, and you

This chapter covers
  • Why the nexus of barcodes and mobile technologies is creating new, exciting opportunities for app makers
  • The barcode symbologies in iOS you should know about
  • The distinctions between 1D and 2D barcodes
  • A brief history of the UPC/GTIN, the mother of modern barcodes
In the past, if you wanted to add barcode scanning to your apps, you had to either fight your way through open source projects or license a commercial barcode-scanning library. None of those projects were written in Objective-C, documentation was lacking, and commercial solutions required payment of license fees for each downloaded copy of your app. All of these issues made barcode scanning impractical for all but the most skilled iOS developers, and too expensive to make economic sense for free or low-cost apps.
When Apple added Passbook to iOS 6, they built in the ability to display barcodes on Passbook passes. With iOS 7, Apple made these APIs public and added the ability to scan barcodes. This allowed them to add barcode-scanning functionality to several of their first-party apps:
  • The Passbook app lets you add new passes to your device by scanning special QR Codes.
  • The iTunes app has the ability to redeem iTunes credits by scanning a voucher.
  • The Apple Store app has an in-store UI that lets you scan the barcodes of accessories for unassisted checkout (see figure 1.1).
    Figure 1.1. Barcode scanning in the Apple Store app
In June 2014, the mother of all barcodes, the UPC, celebrated its 40th anniversary. This makes it an incredibly well understood and ubiquitous technology. Throughout these four decades, different usage scenarios prompted the development of a variety of barcode symbologies that were more or less all informed by the UPC. Apple selected from these the most prevalent and useful kinds of barcodes to support in iOS 7. Support for a few additional barcode symbologies was added in iOS 8. To grasp the full potential of these differing symbologies—as they’re relevant to you in iOS app development—you’ll learn which purposes they’re best used for.
This introductory chapter will give you a solid understanding of barcode technology. Seeing how the multitude of symbologies relate to each other should alleviate any anxiety you might feel right now. You’ll no longer shiver in fear from not knowing the difference between UPC, EAN, GTIN, Code 25, Code 39, Code 93, and Code 128. A brief history of the UPC/GTIN will prove illuminating. Not only has its long history been quite amusing at times, this background will aid greatly in your appreciation of the current state of the GTIN. You’ll become a barcode guru and be able to hold your own in any discussion about barcodes.
In order to appreciate the power of the barcode, we’ll first take a look at how they evolved. Beginning with the UPC, more and more barcode symbologies evolved over time because their predecessors had been designed to solve very specific problems. If you know how to tell them apart—just from glancing at them—you’ll know if you’re looking at an opportunity for a new app.

1.1. The evolution of barcodes

The first barcode in wide use was the Universal Product Code (UPC), combining the semantic meaning of a 12-digit number with a machine-readable scheme for representing this number as a series of bars. It was designed only for automated handling of physical products and was therefore limited to representing numerical product codes. Appendix A will walk you through the history of the UPC and how it became the GTIN, as it’s referred to nowadays by people in the know. Figures 1.2a and 1.2b show some examples of how barcodes have changed over the years.
Figure 1.2a. Timeline of barcodes
Figure 1.2b. Timeline of barcodes
Having overcome the hurdle of enabling a machine to recognize visual markings with a laser beam, a plethora of other kinds of barcodes started to appear, all with more-or-less specific fields of application. For example, the post office found that adding markings to mailed items would allow them to automatically sort the items. Luggage for airline travel was similarly tracked with numeric codes. Other industries had their own standards that worked better for them.
A combination of several bars that make up an individual character or digit is often called a symbol. The set of symbols available for a specific barcode standard is referred to as its symbology. All these different symbologies can be read with a laser beam.

1.1.1. One dimension: laser

Think of a laser beam as cutting out a horizontal slice of the vertical code bars. As the beam moves over the symbol (see figure 1.3), it measures the relative time it spends scanning dark bars and light spaces. A lookup table is then used to decode individual characters from those times.
Figure 1.3. A laser needs to cross all bars of a 1D barcode for scanning
The line of the laser beam is also the reason why these kinds of barcodes are referred to as being one-dimensional (1D).
If you have more-complex encoding schemes, you can also represent letters and special characters. Some 1D barcode types were created to represent short texts.
The long-recognized major advantage of 1D barcodes is that they can be decoded extremely reliably even when the items tagged with such codes are moving at high speed. Some schemes even employ checksums to recognize when something is misread and increase this reliability.
The second advantage of 1D barcodes is cost. Because the technology has been around for 40 years now, the necessary components (laser diode and decoding electronics) have become cheap and reliable. This makes them ideally suited for high-volume deployment as well as for use in environments where you need to scan a great many codes in quick succession.

1.1.2. Two dimensions: CCD

The charge-coupled device (CCD) was invented at AT&T Bell Labs by Willard Boyle and George E. Smith in 1969. This is the chip at the heart of any kind of digital camera. Curiously, the technology for CCDs was invented around the time the first 1D barcode was introduced, but it took decades to develop CCDs to the point where they could compete with the accuracy of their technically much simpler predecessors.
A CCD is essentially a matrix of pixels that reads different binary values for each pixel depending on the light intensity shining on it. As a result, a CCD can read barcodes just like a laser beam can if you have a sufficient number of pixels (a.k.a. resolution). Because the CCD pixels are laid out in two dimensions, CCDs are also able to recognize a new kind of barcode, the two-dimensional (2D) barcode.
Freed of the limitations of one dimension, 2D barcodes usually consist of small rectangles laid out to form a square grid. Figure 1.4 shows such a barcode.
Figure 1.4. A CCD camera can “see” the squares that make up a 2D b...

Table des matiĂšres