Implemented the functionality for ios when the user has enabled the "storeSession" option.