Add the iOS SDK via SPM
- In Xcode, navigate to File > Add Packages...
Alternatively, select your project in the Project Editor, go to the Package Dependencies tab and click Add.
- Select the Sense360 iOS GitHub repository. Enter this GitHub repository URL on the search bar:
https://github.com/medallia/sense360-ios-sdk
- Select the Sense360 iOS SDK version For new projects, we recommend using the newest version of the Sense360 iOS SDK.
By default, Up to Next Major Version is selected. To integrate a specific version of the Sense360 iOS SDK, specify the version number you need.
- Click Add Package Wait for Xcode to finish verifying and downloading the Swift package into your project
- Choose the Sense360 iOS SDK productAfter selecting the product, click Add Package to include it in your application.
- Implement
Sense360.restore
- On the AppDelegate of your app, add this line at the end of the import list:
import SenseQuinoaLib
Note: Make sure to importSenseQuinoaLib
anytime you reference the Sense360 public class. - Add this code snippet to the
AppDelegate
class:func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. let _ = Sense360.restore(sendNotifications: true) UNUserNotificationCenter.current().delegate = self return true }
- On the AppDelegate of your app, add this line at the end of the import list:
- Implement
Sense360.start()
CallSense360.start()
method once the user has granted.authorizedAlways
location permissions and only once during the permission request flow.func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) { switch status { case .notDetermined, .denied, .restricted: // Do some thing case .authorizedWhenInUse: // Proceed to subsequent request default: break } }
func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) { switch status { case .authorizedAlways: try! Sense360.passThirdPartyUserId("1234") // Contact Sense360 Support to obtain the ID let _ = Sense360.start(sendNotifications: true) default: break } }
Note: The above example uses the Sense360 SDK to notify survey availability.