UIAccelerometer Depreciated use Core Motion
I have exported and nearly completed my app in Xcode and I am now sorting out the warnings. This is the first I am having issues with. What do I do here?
(void)start:(CDVInvokedUrlCommand)command
{
NSString cbId = command.callbackId;
NSTimeInterval desiredFrequency_num = kAccelerometerInterval;
UIAccelerometer* pAccel = [UIAccelerometer sharedAccelerometer];// accelerometer expects fractional seconds, but we have msecs
pAccel.updateInterval = desiredFrequency_num / 1000;
self.callbackId = cbId;
if (!self.isRunning) {
pAccel.delegate = self;
self.isRunning = YES;
}
}(void)onReset
{
[self stop:nil];
}(void)stop:(CDVInvokedUrlCommand)command
{
UIAccelerometer theAccelerometer = [UIAccelerometer sharedAccelerometer];theAccelerometer.delegate = nil;
self.isRunning = NO;
}Xcode is first highlighting this:
UIAccelerometer* pAccel = [UIAccelerometer sharedAccelerometer];
and telling me that it is depreciated and that I should be using Core MotionThen the same for:
UIAccelerometer* theAccelerometer = [UIAccelerometer sharedAccelerometer];Any help would be appreciated.