iOS – FAQ & Troubleshooting

Enhanced Restart Mode

Enhanced restart mode is a Point SDK feature to restart an application after termination automatically. See iOS Features – Enhanced SDK restart for more details.

Header Search Path

When the code is edited or compiled in Xcode, a list of file directories known as the Header Search Path is used to collate the valid Class and Method names – collectively termed symbols – from header files. The same applies to standard iOS SDK modules (e.g. Foundation, UIKit, CoreLocation), however, Xcode’s Framework feature automatically includes their headers in the search path.

This differs to a new static library being introduced into a project, which requires Xcode to be explicitly instructed to include a folder of related header files in the Header Search Path. This informs the compiler of the symbols available in the library. The Header Search Path information is used by Xcode in two ways:

  1. During compilation.
  2. When editing, to provide auto-completion and syntax highlighting for libraries’ symbols.

Library Search Path

Xcode builds the target executable binary (the app) in two main phases: compilation and linking.

  • During compilation; the source code files of the app project are analyzed and translated into a set of binary object files. These are objects which have been pre-compiled by Bluedot Innovation for inclusion during the linking phase.
  • During linkingobject files produced by the source code compilation phase, along with the object files contained within in any named libraries (e.g. Point SDK), are selectively joined by the linker into a final, executable binary (the app).

Following the instructions above will add the filesystem path where the Point SDK binaries reside to the linkers Library Search Path. Now the linker will search this location when it is asked to link with a particular named library. Giving the linker the explicit instruction to link against one of Point SDK’s library files will be performed in the next step.

The BDHelloPointSDK target must be configured so that two new options are passed to the linker during the build.

Linker options

The linker’s primary role is to join together compiled binary units called object files into one final, executable app. Typically these object files will be derived from the app’s source code (i.e. the output of the previous compilation phase).

To integrate Point SDK, pre-compiled object files from another source, Point SDK static library, must be included.

This option is comprised of the following three layers:

  1. The specification of the linker option used is -l<library name>, which means ‘link with the named library’. Note that BDPointSDK-${PLATFORM_NAME} was provided as the library name.
  2. The ${PLATFORM_NAME} portion of the name refers to an environment variable that Xcode will automatically replace with either ‘iphoneos‘ or ‘iphonesimulator‘ depending on the platform being built for.
  3. After Xcode’s substitution of the ${PLATFORM_NAME} token, the linker’s own convention is to prefix the name with ‘lib‘ and give it the standard extension for static libraries: ‘.a‘. This produces a final filename for the library which will be either:
    1. libBDPointSDK-iphoneos.a
    2. libBDPointSDK-iphonesimulator.a

It will then attempt to find the named file in the Library Search Path.

Enable linking of Objective-C Categories

Option: -ObjC

Point SDK makes use of Objective-C Categories, in both public and private interfaces.

By default, the linker does not load Categories from static libraries and must be explicitly instructed to do so through the use of the -ObjC flag.

Point SDK will throw an exception if this flag is omitted.

Please refer to the following Apple resource for more information about linker behavior: Building Objective-C static libraries with categories

Apple Mach-O Linker Error

If you encounter an Apple Mach-O Linker Error when you compile your code, there might be some third party library which does not compile with -ObjC flag.

To solve the error, you can use -force_load for Point SDK static libraries (which have been added to Library Search Path): -force_load ${PROJECT_DIR}/PointSDK/libBDPointSDK-iphoneos.a ${PROJECT_DIR}/PointSDK/libBDPointSDK-iphonesimulator.a

Created by Bluedot DevOps on January 16, 2018

Start the discussion