iOS SDK
Start the SDK
iOS Application Delegate
5 min
the fortersdk needs to be initialized from the application delegate as the primary root of an ios app, the app delegate object is created early in your app's launch cycle and the initialization of the forter sdk within the app delegate will ensure that it loads correctly when the app is active for more information on the app delegate, please see the offical ios developer documentation https //developer apple com/documentation/uikit/uiapplicationdelegate 1\ initialize from the application delegate the fortersdk needs to be initialized from the application delegate import the sdk using import fortersdk for swift #import \<fortersdk/fortersdk h> for obj c retrieve your site id from the credentials https //portal forter com/app/integration/credentials/ section of forter portal and make sure to toggle to the correct sandbox or production environment initialize the fortersdk with your site id by adding the following line to your application delegate's \ didfinishlaunchingwithoptions https //developer apple com/reference/uikit/uiapplicationdelegate/1622921 application method fortersdk setup(withsiteid "your site id") \[fortersdk setupwithsiteid @"your site id"]; 2\ add callbacks from the application delegate when receiving messages to your application delegate please call the corresponding methods in fortersdk's delegate, ftrsdkapplicationdelegate for example, upon receiving a call to applicationdidbecomeactive( ) https //developer apple com/documentation/uikit/uiapplicationdelegate/applicationdidbecomeactive( ) your delegate should look like the following func applicationdidbecomeactive(application uiapplication) { 	ftrsdkapplicationdelegate sharedinstance() applicationdidbecomeactive(application) } \ (void)applicationdidbecomeactive (uiapplication )application { \[\[ftrsdkapplicationdelegate sharedinstance] applicationdidbecomeactive application]; } please note that if you’re using scenes https //developer apple com/documentation/uikit/scenes , uikit will not call applicationdidbecomeactive to ensure applicationdidbecomeactive is still forwarded to fortersdk in scene based apps, listen for didbecomeactivenotification https //developer apple com/documentation/uikit/uiapplication/didbecomeactivenotification instead notificationcenter default addobserver( self, selector #selector(handleappdidbecomeactive), name uiapplication didbecomeactivenotification, object nil ) @objc func handleappdidbecomeactive() { ftrsdkapplicationdelegate sharedinstance() applicationdidbecomeactive(uiapplication shared) } \[\[nsnotificationcenter defaultcenter] addobserver\ self selector @selector(handleappdidbecomeactive) name\ uiapplicationdidbecomeactivenotification object\ nil]; \ (void)handleappdidbecomeactive { \[\[ftrsdkapplicationdelegate sharedinstance] applicationdidbecomeactive \[uiapplication sharedapplication]]; } please make sure to call all the appdelegate callbacks