Skip to Content
Basic Sensors in iOS
book

Basic Sensors in iOS

by Alasdair Allan
July 2011
Beginner to intermediate
108 pages
2h 29m
English
O'Reilly Media, Inc.
Content preview from Basic Sensors in iOS

Setting Required Hardware Capabilities

If your application requires specific hardware features in order to run you can add a list of required capabilities to your application’s Info.plist file. Your application will not start unless those capabilities are present on the device.

To do this, open the project and click on the application’s Info.plist file to open it in the Xcode editor. Click on the bottommost entry in the list. A plus button will appear to the right-hand side of the key-value pair table.

Click on this button to add a new row to the table, and scroll down the list of possible options and select “Required device capabilities” (the UIRequiredDeviceCapabilities key). This will add an (empty) array to the plist file.

The allowed values for the keys are:

  • telephony

  • wifi

  • sms

  • still-camera

  • auto-focus-camera

  • front-facing-camera

  • camera-flash

  • video-camera

  • accelerometer

  • gyroscope

  • location-services

  • gps

  • magnetometer

  • gamekit

  • microphone

  • opengles-1

  • opengles-2

  • armv6

  • armv7

  • peer-peer

A full description of the possible keys is given in the Device Support section of the iPhone Application Programming Guide available from the iPhone Development Center.

Persistent WiFi

If your application requires a persistent WiFi connection you can set the Boolean UIRequiresPersistentWiFi key in the Application’s Info.plist file to ensure that WiFi is available. If set to YES the operating system will open a WiFi connection when your application is launched and keep it open while the application is running. If this key is not present, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

iOS 7 Programming Cookbook

iOS 7 Programming Cookbook

Vandad Nahavandipoor
iOS 4 Programming Cookbook

iOS 4 Programming Cookbook

Vandad Nahavandipoor
iPhone and iPad App 24-Hour Trainer

iPhone and iPad App 24-Hour Trainer

Abhishek Mishra, Gene Backlin

Publisher Resources

ISBN: 9781449309480Errata Page