Configuring Your XCode Project

To integrate the core framework into your own app:

  1. Embed the FTMCore.framework in your app.
  2. Configure Info.plist and background modes.
    Note

    Note

    Your app's Info.plist must include these four usage descriptions:
    • NSBluetoothPeripheralUsageDescription - The core framework must be able to interact with Bluetooth peripherals in order to function properly.
    • NSLocationAlwaysUsageDescription - The always mode of location services is required, as opposed to when in use. Otherwise your app would not be notified when coming into range of beacons.
    • NSLocationAlwaysAndWhenInUseUsageDescription - iOS 11 requires this key.
    • NSLocationWhenInUseUsageDescription - iOS 11 requires this key.

    Choose descriptions that are appropriate for your app.

    If you intend to monitor beacons broadcasting in payment mode (rather than private mode), the bluetooth-central background mode must be enabled. This can be done in one of two ways:

    • In Xcode, select the target, then select Capabilities > Turn on Background Modes, and check the box for Uses Bluetooth LE accessories.
    • In your Info.plist file, add UIBackgroundModes with an entry for bluetooth-central.
  3. Add a run script to your project, and then copy the following script:
    #
    # This script removes unused architectures from Footmarks frameworks, which are
    # fat binaries that make it possible to develop apps in both the simulator and
    # on device. Apple does not allow app store submissions to contain simulator
    # architectures.
    #
    # In Xcode, select the target, then Build Phases, and make sure this script
    # comes after the "Embed Frameworks" step.
    #
    # Based on:
    # http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/
    #
    
    APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
    find "$APP_PATH"-name'FTM*.framework'-type d | while read-r FRAMEWORK
    do
        FRAMEWORK_EXECUTABLE_NAME=$(defaults read"$FRAMEWORK/Info.plist" CFBundleExecutable)
        FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
        echo"Executable is $FRAMEWORK_EXECUTABLE_PATH"
        EXTRACTED_ARCHS=()
    
        for ARCH in$ARCHS
        do
            echo"Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
            lipo -extract"$ARCH""$FRAMEWORK_EXECUTABLE_PATH"-o"$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
            EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
        done
    
        echo"Merging extracted architectures: ${ARCHS}"
        lipo -o"$FRAMEWORK_EXECUTABLE_PATH-merged"-create"${EXTRACTED_ARCHS[@]}"
        rm"${EXTRACTED_ARCHS[@]}"
    
        echo"Replacing original executable with thinned version"
        rm"$FRAMEWORK_EXECUTABLE_PATH"
        mv"$FRAMEWORK_EXECUTABLE_PATH-merged""$FRAMEWORK_EXECUTABLE_PATH"
    done
  4. Get your app key and secret from https://manage.extremelocation.com to use the core framework.