Page 1 of 1

UIAccelerometer Depreciated use Core Motion

Posted: Sun Apr 27, 2014 11:04 am
by Maurice

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.


UIAccelerometer Depreciated use Core Motion

Posted: Sun Apr 27, 2014 11:30 am
by Maurice

Here is a screen shot of the warning.
Image


UIAccelerometer Depreciated use Core Motion

Posted: Mon Apr 28, 2014 7:17 am
by Kateryna Grynko

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.


UIAccelerometer Depreciated use Core Motion

Posted: Mon Apr 28, 2014 12:37 pm
by Maurice

Many thanks Katya.


UIAccelerometer Depreciated use Core Motion

Posted: Sat May 03, 2014 8:27 am
by Maurice

Hi Katya, how do i use the latest library?


UIAccelerometer Depreciated use Core Motion

Posted: Sat May 03, 2014 8:42 am
by Igor

Hello,

This doc will help:
http://docs.appery.io/documentation/a...


UIAccelerometer Depreciated use Core Motion

Posted: Sat May 03, 2014 8:50 am
by Maurice

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


UIAccelerometer Depreciated use Core Motion

Posted: Sat May 03, 2014 10:01 am
by Maurice

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