CMMotionActivityManager

CMMotionActivityManager用于获取用户当前所处的状态,如在自行车、车里或徒步行走等。

1 Determining Activity Availability

// 能否获取活动状态
public class func isActivityAvailable() -> Bool

2 Starting and Stopping Activity Updates

// 队列中获取活动状态
public func startActivityUpdatesToQueue(queue: NSOperationQueue, withHandler handler: CMMotionActivityHandler)

/// 停止获取活动状态
public func stopActivityUpdates()

3 Getting Historical Activity Data

// 获取某个时间段的活动状态
public func queryActivityStartingFromDate(start: NSDate, toDate end: NSDate, toQueue queue: NSOperationQueue, withHandler handler: CMMotionActivityQueryHandler)

 

Appendix

Sample Code

Swift

Core Motion Framework Reference

CMMotionActivityManager Class Reference

Revision History

时间 描述
2016-01-27 博文完成

CSDN:http://blog.csdn.net/y550918116j

GitHub:https://github.com/937447974/Blog

你可能感兴趣的:(CMMotionActivityManager)