How to detect IPhone/iPad is shutting down/Switching Off?

After detecting device is shutting down..Can i parse an API before it Shut Down or Power Off?

What do you mean "After detecting device is shutting down"? Generally if the system needs to terminate your app it will simply terminate it. There's no mechanism for performing work at shut down or power off.

How to detect IPhone/iPad is shutting down/Switching Off?
 
 
Q