author Sam Lantinga
Wed, 25 Jun 2014 00:20:21 -0700
changeset 8921 4a9feef61c85
parent 7925 f090a47eb7f7
child 9876 1496e502e51d
permissions -rwxr-xr-x
Fixed bug 2603 - iOS: update joystick accelerometer code to use CoreMotion instead of the deprecated UIAccelerometer

Alex Szpakowski

SDL's code for exposing the accelerometer as a joystick on iOS currently uses UIAccelerometer, which was superseded by the CoreMotion framework and deprecated since iOS 5.

The UIAccelerometer code still works (for now), but it also throws deprecation warnings whenever SDL is built for iOS, since SDL's deployment target is no longer below iOS 5.

I've created a patch which replaces the old UIAccelerometer code with a replacement based on the CoreMotion framework. It has identical functionality (to SDL users), however iOS apps are now required to link to the CoreMotion framework when using SDL.
     1 Use the Xcode command files (located in the Xcode-iOS/build-scripts folder)
     2 to conveniently generate a workspace for Xcode 3 or Xcode 4. It also
     3 contains a cleaner script and a convenient script for automatically
     4 running all the test suites.
     6 The iOS project will be referencing all files related to the top-level iOS
     7 project. The core library will use the top-level include and src directories,
     8 just like the other generated projects, but it will build projects for each of
     9 the Demos in the top-level Xcode-iOS folder. These projects will have any
    10 resources they need copied to be copied over and included as resources. They
    11 will also reference the Info.plist file in Xcode-iOS/Demos.
    13 iOS support is currently experimental, but it should work just fine for any and
    14 all applications. All of the demos that work from the manually-created Xcode
    15 projects also work for the generated projects. There are a few minor things that
    16 need improving, but nothing major.
    18 The iOS projects have no major dependencies other than the ones in the manual
    19 Xcode-iOS project. Those are:
    21   -AudioToolbox.framework
    22   -QuartzCore.framework
    23   -OpenGLES.framework
    24   -CoreGraphics.framework
    25   -UIKit.framework
    26   -Foundation.framework
    27   -CoreAudio.framework
    28   -CoreMotion.framework
    30 All of these frameworks are part of the iOS SDK, not part of the core OS X
    31 system.
    33 Run the clean script to clear out the directory of Xcode-related files
    34 and binaries.