Join Steven Lipton for an in-depth discussion in this video Detect devices, part of Advanced iOS App Development: Core Motion.
- [Instructor] You saw with the pedometer…that checking for sensors is important.…Once again, you'll want to check…for sensor availability in the user's device.…This should always be the first step in launching your app:…letting the user know they can't use this on their device.…Go to ViewController.swift,…close up the attributes inspector and the navigator.…We won't be using either one of them.…In ViewController go ahead and put…in the import CoreMotion just under UIKit.…
There's a class CMMotionManager…that manages device availability,…pushing and pulling of sensor data.…We'll use the Core Motion Manager…for the gyro and accelerometer.…Add the motion manager to the class.…Let motionManager…= CMMotionManager.…Our first order of business is…to check if the device has the sensors.…
We'll send an alert if any of the devices are unavailable.…I'll also return that value so the rest…of the app can decide to launch.…So we're going to go ahead and add a function;…isDevicesAvailable and it will return a Bool.…There's two ways you could check for availability.…
- Reading Core Motion data
- Understanding Core Motion methods
- Creating a pedometer app
- Using pace and distance data from Core Motion
- Pushing and pulling device motion data
- Accessing the altitude sensors
- Working with the motion activity manager (CMMotionActivityManager)
Skill Level Advanced
iOS App Development: Accessibilitywith Kevin Favro2h 34m Intermediate
Advanced iOS Development: Working with APIswith Saul Mora1h 59m Intermediate
1. Core Motion Introduction
3. Device Motion
5. Recorded Data
Next steps1m 43s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.