Maurice
Posts: 0
Joined: Sun Mar 23, 2014 5:25 pm

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 Motion

    Then the same for:
    UIAccelerometer* theAccelerometer = [UIAccelerometer sharedAccelerometer];

    Any help would be appreciated.

Maurice
Posts: 0
Joined: Sun Mar 23, 2014 5:25 pm

UIAccelerometer Depreciated use Core Motion

Here is a screen shot of the warning.
Image

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

UIAccelerometer Depreciated use Core Motion

Hi Maurice,

Use the latest library version please. You can use depreciated, this is just not recommended but will work. You won't see this warning in 2.0 after the next Appery.io release.

Maurice
Posts: 0
Joined: Sun Mar 23, 2014 5:25 pm

UIAccelerometer Depreciated use Core Motion

Many thanks Katya.

Maurice
Posts: 0
Joined: Sun Mar 23, 2014 5:25 pm

UIAccelerometer Depreciated use Core Motion

Hi Katya, how do i use the latest library?

Maurice
Posts: 0
Joined: Sun Mar 23, 2014 5:25 pm

UIAccelerometer Depreciated use Core Motion

Hi Igor
Thanks, I'll read over it now.
Regards

Maurice
Posts: 0
Joined: Sun Mar 23, 2014 5:25 pm

UIAccelerometer Depreciated use Core Motion

Igor
Thank you so much. This fixed my issues.
Only one build issue now. I will start a new threat for it.
Thanks again.

Return to “Issues”