Skip to content

Linking StreetHawk SDK Manually

Introduction

This tutorial explains steps for manually integrating StreetHawk into your iOS application.

Integration Steps

  • Download StreetHawk SDK. Unzip the file and find StreetHawkCore.framework inside Pod folder. Copy it into your project folder.
  • Open your app in Xcode, go to: Build Phases Link Binary With Libraries, check to make sure link StreetHawkCore.framework.
  • Add frameworks: CoreTelephony.framework, CoreLocation.framework and libsqlite3.dylib library.
  • In project settings->Build Phases->Copy Bundle Resources->Click “+”->Add Other, and then find and double click the “StreetHawkCore.framework” to open it, then add the “StreetHawkCoreRes.bundle” file.
  • Route to “Project Settings” -> “Build Settings” Tab -> “Linking” -> “Other Linker” Flags (or search “Other Linker” in the search field), and add -ObjC to both Debug and Release.

  • Additionally modify Info.plist as

    • Add NSLocationAlwaysAndWhenInUseUsageDescription and NSLocationWhenInUseUsageDescription: request “Always” permission. This is needed when you use location functions, including "streethawk/Locations" or "streethawk/Geofences" or "streethawk/Beacons".

    • In the Project Settings window -> Capabilities pane, if Background Modes isn’t enabled, click the switch in the Background Modes section, then enable Background Fetch.

  • Config for push.

  • Initialise StreetHawk inside AppDelegate.m by adding following lines.
#import <StreetHawkCore/StreetHawkCore.h> // StreetHawk header file

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[StreetHawk registerInstallForApp:<your_app_key> withDebugMode:YES<print log info>];

return YES;
}

Swift code:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
SHApp.sharedInstance().registerInstall(forApp: <app_key>, withDebugMode: true(print log info))
return true
}

where,

  • your_app_key: The app_key register on StreetHawk Cloud.
  • debugMode (Yes or No): This is to print verbos:1e logging to the device console.

StreetHawk automatically configures a lot of system AppDelegate functions. In case there is a need to configure AppDelegate functions manually, then follow iOS Manual Setup.