Skip to Main Content
Basic Sensors in iOS
book

Basic Sensors in iOS

by Alasdair Allan
July 2011
Beginner to intermediate content levelBeginner 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.
Start your free trial

You might also like

Building iPhone and iPad Electronic Projects

Building iPhone and iPad Electronic Projects

Mike Westerfield
iPhone and iPad App 24-Hour Trainer

iPhone and iPad App 24-Hour Trainer

Abhishek Mishra, Gene Backlin
BioCoder #3

BioCoder #3

O'Reilly Media, Inc.
iOS 7 Programming Cookbook

iOS 7 Programming Cookbook

Vandad Nahavandipoor

Publisher Resources

ISBN: 9781449309480Supplemental ContentErrata Page