Lecture 11

Lecture 11 - Stanford CS193p Developing Applications for...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Stanford CS193p Fall 2011 Developing Applications for iOS Fall 2011 Stanford CS193p
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Stanford CS193p Fall 2011 To day Core Location Finding out where the device is MapKit Showing the location of things on a map Demo MapKit
Background image of page 2
Stanford CS193p Fall 2011 Core Location Framework for managing location and heading No user-interface. Basic object is CLLocation @properties : coordinate , altitude , horizontal / verticalAccuracy , timestamp , speed , course Where (approximately) is this location? @property (readonly) CLLocationCoordinate2D coordinate; typedef { CLLocationDegrees latitude; // a d o u b le CLLocationDegrees longitude; // a d o u b le } CLLocationCoordinate2D; @property (readonly) CLLocationDistance altitude; // meters A negative value means “below sea level.”
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Stanford CS193p Fall 2011 Core Location How close to that latitude/longitude is the actual location? @property (readonly) CLLocationAccuracy horizontalAccuracy; // i n m e t e r s @property (readonly) CLLocationAccuracy verticalAccuracy; // i n m e t e r s A negative value means the coordinate or altitude (respectively) is invalid. kCLLocationAccuracyBestForNavigation; // phone should be plugged in to power source kCLLocationAccuracyBest; kCLLocationAccuracyNearestTenMeters; kCLLocationAccuracyHundredMeters; kCLLocationAccuracyKilometer; kCLLocationAccuracyThreeKilometers; The more accuracy you request, the more battery will be used Device “does its best” given a speci±ed accuracy request Cellular tower triangulation (not very accurate, but low power) WiFi node database lookup (more accurate, more power) GPS (very accurate, lots of power)
Background image of page 4
Stanford CS193p Fall 2011 Core Location Speed @property (readonly) CLLocationSpeed speed; // i n m e t e r s /s e c o n d Note that the speed is instantaneous (not average speed). Generally it’s useful as “advisory information” when you are in a vehicle. A negative value means “speed is invalid.” Course @property (readonly) CLLocationDirection course; // in degrees, 0 is north, clockwise Not all devices can deliver this information. A negative value means “course is invalid.” Time stamp @property (readonly) NSDate *timestamp; Pay attention to these since locations will be delivered on an inconsistent time basis. Distance between CLLocation s - (CLLocationDistance)distanceFromLocation:(CLLocation *)otherLocation; // i n m e t e r s
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Stanford CS193p Fall 2011 Core Location How do you get a CLLocation ? Almost always from a CLLocationManager (sent to you via its delegate ). Can be tested in the simulator from Xcode.
Background image of page 6
Stanford CS193p Fall 2011 Core Location How do you get a CLLocation ? Almost always from a CLLocationManager (sent to you via its delegate ). Can be tested in the simulator from Xcode. CLLocationManager
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 33

Lecture 11 - Stanford CS193p Developing Applications for...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online