Developer Hub
SupportDashboardGuides
Developer hub
Developer hub
  • Home
  • WiFi SDK
    • Overview
    • Integrating the SDK
      • iOS
        • QuickStart
        • SDK methods
          • initC4w
          • createCustomer
          • setupCustomer
          • createWPA2EnterpriseProfile
          • createPasspointProfile
          • getCreatedWPA2EnterpriseProfiles
          • getCreatedPasspointProfiles
          • getCustomerId
          • getCustomerInfo
          • updateCustomer
          • updateCustomerInfo
          • checkIfCustomerExists
          • getListOfPolicies
          • deletePasspointProfile
          • deleteWPA2EnterpriseProfile
          • setAPIAuthParams
          • setInterlinkedC4WIMobileSDKApplications
          • getInterlinkedC4WIMobileSDKApplications
          • logout
        • Objects
          • Customer
          • CustomerDocument
          • CustomerCreateResponse
          • CustomerInfo
          • CustomerQuery
          • WPA2EnterpriseProfile
          • PasspointProfile
        • Additional features
        • Changelog
      • Android
        • QuickStart
        • SDK methods
          • initC4w
          • createCustomer
          • setupCustomer
          • createWPA2EnterpriseProfile
          • deleteWPA2EnterpriseProfile
          • createPasspointProfile
          • deletePasspointProfile
          • isPasspointSupported
          • getCustomerId
          • getCustomerInfo
          • checkIfCustomerExists
          • updateCustomer
          • updateCustomerInfo
          • getListOfPolicies
          • setAPIAuthParams
          • getCreatedWPA2EnterpriseProfiles
          • getCreatedPasspointProfile
          • setInterlinkedC4WIMobileSDKApplications
          • getInterlinkedC4WIMobileSDKApplications
          • logout
        • Objects
          • Customer
          • CustomerDocument
          • CustomerCreateResponse
          • CustomerInfo
          • CustomerQuery
          • WPA2EnterpriseProfile
          • PasspointConfiguration
        • Additional features
        • Troubleshooting
        • Changelog
      • Flutter
        • QuickStart
        • Changelog
    • User experience
    • FAQ
  • Location SDK
    • Overview
    • Integrating the SDK
      • Android
        • Quickstart
        • Project initialization
        • SDK Methods
          • Enable/Disable
          • Handling blocking issues
          • Get Device Id
          • Reset device Id
          • Locations of Interest
            • Home location
            • Work location
        • Changelog
      • iOS
        • QuickStart
        • Installation
        • Project initialization
        • SDK methods
          • Initialization
          • Enable/Disable
          • Get Device Id
          • Reset device Id
          • Locations of interest
            • Home location
            • Work location
        • Reference versions
        • Changelog iOS
      • Flutter
        • QuickStart
        • Changelog
  • Demo toolkit
    • Demo app
    • Testlab WiFi setup
  • API Reference
    • Getting started
      • Authentication
      • Contacts
      • Locations
      • Geofences
      • Devices
      • Segments
      • WiFi logs
      • Events
    • Webhooks
    • Use cases
    • Legacy APIs (v2)
  • MyApps
    • My App Intro
    • Creating Apps
      • Access Journey Apps
      • Apps for the Dasbhoard
    • MyApps APIs and SDK
      • Access Journey SDK
      • REST APIs in MyApp
      • Context APIs
    • Sample projects
      • MyApps -Js SDK boilerplate
      • Video Advertising
      • Typeform integration
      • Facebook Pixel in Acces Journey
  • Tutorials
    • Sample onboarding flow for new app users
    • Integrating WiFi SDK in Flutter apps
Powered by GitBook
On this page
  • Project settings
  • Initialize Users

Was this helpful?

Export as PDF
  1. Location SDK
  2. Integrating the SDK
  3. iOS

Project initialization

Project settings

Mobile key

Add the following key to Info.plist file (String value) with the corresponding value (that you obtained when added your app to your project)

<key>GUMobileKey</key>
<string>'your-mobile-key'</string>

Location usage keys

  1. Add the following keys to Info.plist file (String value), the corresponding values will be shown to the user by iOS

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>We would like to access your locations</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>We would like to access your locations</string>

If your app supports iOS add

<key>NSLocationAlwaysUsageDescription</key>
<string>We would like to access your locations</string>

  1. Add the following key to Info.plist file (String value), it will be used to show a popup to the user before the provided by iOS. Only if the user accepted this first popup we request the permission to iOS.

<key>GULocationPermissionNotDetermined</key>
<string>We would like to ask your permission to access your locations</string>

Background fetch

In order to obtain a greater number of positions we suggest to enable this feature. To do this carry out these two steps:

  1. Select your project -> Select your target -> Select 'Signing & Capabilities' tab -> tap on '+ Capability' -> select 'Background Modes' -> check 'Background fetch'

  2. In AppDelegate add this code:

//Swift
/* ------ AppDelegate.swift ------ */

func application(application: UIApplication, performFetchWithCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void){
    //call GeoUniq backgroundFetch() method
    GeoUniq.sharedInstance().backgroundFetch()
}
//Objective C
/* ------ AppDelegate.m ------ */

- (void) application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
    //call GeoUniq backgroundFetch() method
    [[GeoUniq sharedInstance] backgroundFetch];
    completionHandler(UIBackgroundFetchResultNewData);
}

App Tracking Transparency

iOS 14 introduced the permission request to get the device's IDFA. In this regard, we have introduced two methods in our framework.

The first one checking the permission status:

...
let permissionStatus = GeoUniq.sharedInstance().getATTrackingAuthorizationStatus()
...

And the second one that makes the request and returns the user's choice:

...
GeoUniq.sharedInstance().requestATTrackingAuthorization { (status) in
    // Use status if you want
}
...

It is possible to use these methods but also the methods provided directly by iOS. There is no need to communicate to our framework the outcome of the permission. Invoke the request method as soon as possible. For example right after the enable.

...
GeoUniq.sharedInstance().enable()
GeoUniq.sharedInstance().requestATTrackingAuthorization { (status) in
    // Use status if you want
}
...

Important: Before invoking the method for the request (both Geouniq and iOS) it is necessary to insert the key in the plist

<key>NSUserTrackingUsageDescription</key>
<string>The identifier will be used to personalise ads across apps and websites and to conduct marketing and research analysis</string>

Initialize Users

In order to track geofencing events, you need to initialize a user in your Cloud4Wi account.

The method to initialize users is exposed in the WiFi SDK, so you need to integrate also the WiFi SDK into your project.

Once both the WiFi and Location SDKs are installed you can use the following snippet to initialize the customer in Cloud4Wi as soon the deviceId is assigned to the phone. This function will initialize an anonymous user without any additional attribute or personal data associated.

let _ = GeoUniq.sharedInstance { deviceId in
            let cloud4WiSDKWiFi = Cloud4WiSDKWiFi.init()
            cloud4WiSDKWiFi.setupCustomer { customerResponse in
                if let customerResponse = customerResponse {
                    print(customerResponse)
                }
            } onError: { error in
                print(error!)
            }
        }

PreviousInstallationNextSDK methods

Last updated 2 years ago

Was this helpful?

In the alternative, you can use the native WiFi SDK methods to .

initialize a customer