Tracking event and session data when a device is offline with the iOS SDK

Last Updated: Jan 17, 2016 10:29PM PST

When a user’s device is connected to the Internet, the session and event data is sent as it occurs to Apsalar using a background thread. In the case where the device is offline, this timestamped data is buffered until that time when the device is back online, at which time the buffer is flushed and the data is sent to Apsalar. The buffering occurs in a SQLite database file named Apsalar_XXXX.sqlite, where XXXX is a 40-character hexadecimal SHA1 hash of the API key, secret, and longname. The file is stored in the application’s Library directory.

To avoid uncontrolled expansion of the Apsalar event buffering database, the Apsalar SDK will only record up to 1000 sessions and events. If the buffer is full, any subsequent sessions and events will not be recorded. This limit can be changed by sending the API the setBufferLimit message:

[Apsalar setBufferLimit:1000];

where the argument is your desired size of the buffer. Based upon your app and the nature of your users, you may want to increase this. It is not recommended to reduce the buffer below 1000.

To minimize wear and tear on the device’s NAND flash memory, we only write to the database when an Internet connection is unavailabe, or not functional.
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found