Way too many apps on the App Store totally break when you loose connectivity. Have a look at some study cases and hopefully by the end you will figure out that implementing offline mode in your app is not that difficult at all.
31. cinemas in Berlin - these change once a year
!
film schedule changes every thursday
!
static information - practically doesn’t change
!
ticket reservations
Photo credit: Flickr, Tobias Abel Photo credit: Flickr, InSapphoWeTrust
32. 12 cinema photos + their names + coordinates
25 film posters + film names
30 movie times for all cinemas
!
7KB sqlite file
2MB of photos
!
=
!
< 1 Facebook photo in size
44. For long lists - use sqlite
AAPL!
123456 11.6 10.5
123459 11.5 10.5
123460 12.0 11.0
123470 14.0 11.5
123490 14.0 10.5
Easy to sync to local database
server database JSON local sqlite
AAPL!
!
!
!
123470 14.0 11.5
123490 14.0 10.5
aapl
keep ids from the server
45. How to fetch the delta data?
14:40 14:50 15:00
+ tokenA + tokenB + tokenC
+ tokenA + tokenB
46. Facebook
posts come in all the time
!
posting in not time crucial
!
chat with friends
!
location check-in
52. Core Data = power + pain
You need to recreate the relationships
Migration strategy
53. What’s the foreseeable outcome of the create/edit
operations?
Data validation
Cache the create operation data
54. 3 ways to store temporary objects
!
1. create the new objects, store them using NSCoding
2. create a separate store for pending objects
3. use existing store, but use ids < 0
56. cloud
Network layer
REST
JSON RPC
JSON API
XML? plist?
Connectivity
User Interface
data storage
NSCoding
sqlite3
Core Data
Cache
file system
Core Data
file storage
You probably have this setup
57. cloud
Network layer
REST
JSON RPC
JSON API
XML? plist?
Connectivity
User Interface
data storage
NSCoding
sqlite3
Core Data
Cache
file system
Core Data
file storage
You want to have this setup
74. Turn on plane mode and check how your
favorite apps look like
Check how your app looks like (eeek!)
Get in touch, discuss, check out the power-tools