Questions tagged [cmmotionmanager]

Use for questions regarding CMMotionManager objects; an NSObject class in the Core Motion framework and MonoTouch.CoreMotion Namespace.

CMMotionManager is an NSObject class in the Core Motion framework and MonoTouch.CoreMotion Namespace.

A CMMotionManager instance provides access to motion services and data, including accelerometer and magnetometer data.

Motion services are not available on all devices -- the deviceMotionAvailable boolean property indicates whether or not motion services are available.

Resources

152 questions
2
votes
2 answers

Get accelerometer and gyroscope data from apple watch (and not the iphone)?

After seeing this question, I tried to code up a quick program that would save the watches accelerometer and gyroscope data to a file. @implementation InterfaceController{ NSMutableArray *accData; bool recording; } -…
Chase Roberts
  • 9,082
  • 13
  • 73
  • 131
2
votes
0 answers

What are all the attributes of CMDeviceMotion?

Looking at all the data I can get from a CMDeviceMotion, I'm trying to make sense of the difference between all of these data points. Is it accurate to say that the following? Acceleration is how fast I am moving in the various…
Chase Roberts
  • 9,082
  • 13
  • 73
  • 131
2
votes
1 answer

Cannot invoke 'startAccelerometerUpdatesToQueue' with an argument list of type

I am trying to instantiate CMMotionManager while running the following code: motionManager.startAccelerometerUpdatesToQueue(NSOperationQueue.currentQueue(), withHandler: { (accelerometerData: CMAccelerometerData!, error: NSError!) in // 3 …
user190494
  • 509
  • 2
  • 8
  • 20
2
votes
1 answer

Map device tilt to physicsWorld gravity?

I'm building a "marble" labyrinth game in order to learn spritekit basics. I want to map the gravity of the game to the tilt of the device. I've been trying to figure out how to do it but I've only been able to map the y axis successfully: class…
lisovaccaro
  • 32,502
  • 98
  • 258
  • 410
2
votes
1 answer

CMMotionActivityManager callback when user not allow the permisson

I am using the following code from the Privacy Prompts project to get the Motion Permission. - (void)requestMotionAccessData { self.cmManager = [[CMMotionActivityManager alloc] init]; self.motionActivityQueue = [[NSOperationQueue alloc]…
Madu
  • 4,849
  • 9
  • 44
  • 78
2
votes
1 answer

Motion activity to work in suspended state in ios

I am using M7 processor motion activity in one of my applications. I want to get motion activity updates when the app is in suspended state also. I dont want to call startUpdatingLocation to keep prevent from enterning the app into suspended state,…
2
votes
1 answer

Devicemotion is not updating values

I am unable to figure out why the roll, pitch and yaw values are giving 0.0000 when logged.. I am sure it is a something that i miss but i cant figure it out.. This is the code: //ViewController.m #import "ViewController.h" @interface…
iSeeker
  • 776
  • 1
  • 8
  • 24
2
votes
1 answer

How to determine the age of CMDeviceMotion in seconds

I want to be able to turn device motion updates on and off during my game. But after I turn them off and then back again, .deviceMotion property of CMMotionManager returns the last know deviceMotion for a short while (around 0.5 seconds, until it…
baris
  • 304
  • 2
  • 14
2
votes
0 answers

How to create a class to apply motion-related effect to a view?

Relative newcomer here, sorry for sort of newbie question. I've tried searching for the answers. I've coded up a way to apply a visual animation effect to a UIImageView on a view controller, based on the angle at which the user is holding the…
andrewmobile
  • 188
  • 1
  • 8
2
votes
1 answer

How can i know the swinging direction of the ios device in ios programming?

I'm new to IOS programming, I don't know how to judge the swinging direction of a device.And I have searched a long time for this question, but I only find very little about this. Could someone help me? Thanks very much!
Abel_CN
  • 64
  • 6
2
votes
1 answer

iPhone motion data blocked by Compass Calibration setting

My app has an augmented reality camera view which uses CMMotionManager to find heading relative to true north. However, I am finding that if the user switches OFF Location Services / System Settings / Compass Calibration, then the device motion data…
gpdawson
  • 713
  • 6
  • 15
1
vote
1 answer

deviceMotion not returning anything for pitch, roll, or yaw

I'm trying to get some simple code working to log the pitch, roll, and yaw of my iPhone 4S. It's firing the timer correctly, but the values of pitch, roll, and yaw, are always displayed in the console as 0.0000000. What am I missing here? Any help…
Luke
  • 9,512
  • 15
  • 82
  • 146
1
vote
0 answers

CMMotionActivity Battery Consumption

I'm developing an app where I need to detect motion activity changes with accuracy. I'm thinking of two approaches: Keep the CMMotionActivity active all the time; Start/Stop the CMMotionActivity in periods of 30 seconds. Do you know which of this…
Daantunes
  • 11
  • 1
1
vote
0 answers

How to know device is tilting to left/right/backward or front using CMMotionManager

I need to identify which way iOS device is tilting, left, right, forward, backward. I am trying to identify this with below code but not working. self.motionManager.isDeviceMotionAvailable { self.motionManager.deviceMotionUpdateInterval = 1 …
Sekhar Bhetalam
  • 4,501
  • 6
  • 33
  • 52
1
vote
0 answers

Ios magnetometer wrong values

I am writing code to detect magnet. I am doing this through this code: let manager = CMMotionManager() if manager.isMagnetometerAvailable { manager.startMagnetometerUpdates(to: OperationQueue.main) { (data, error) in let bField =…
Salman Khalid
  • 543
  • 5
  • 23
1 2
3
10 11