Call Api when user kill the app

I am creating app in which when user login i am hitting create session api and when user kill the app or not using the app i want to call delete session api. So how i can implement this feature

Did you try to implement it in AppDelegate function:

func applicationWillTerminate(_ application: UIApplication) {
      // call delete session api
}
Call Api when user kill the app
 
 
Q