{"id":6322,"date":"2020-10-23T15:44:55","date_gmt":"2020-10-23T10:14:55","guid":{"rendered":"https:\/\/www.innovationm.com\/blog\/?p=6322"},"modified":"2023-01-20T18:55:14","modified_gmt":"2023-01-20T13:25:14","slug":"offline-data-handling-in-ios","status":"publish","type":"post","link":"https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/","title":{"rendered":"Offline data handling in iOS"},"content":{"rendered":"<h3><b>Why Offline handling?<\/b><\/h3>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Offline data handling in iOS apps isn\u2019t an extra feature anymore. Users want and expect it as a default feature in apps. So it is necessary to save data in our apps.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Data from researches and surveys show that users abandon pages if they take more than 3 seconds to load. This makes Offline handling even more important, as it can make apps fast.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Unlike laptops, which are generally used where the network\/internet is available. But for mobile apps, the internet can\u2019t be available all the time (user on a plane, a cafe, a subway etc.). So for better user experience, it becomes crucial that we give offline support too.<\/span><\/li>\n<\/ol>\n<h3><b>How to do it?<\/b><\/h3>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">There are many different ways: databases(realm and core data), cache etc. Each has its own advantages and disadvantages. We have to decide based on our requirement and ease of implementation.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">So, choose wisely weighing all pros and cons.<\/span><\/li>\n<\/ol>\n<h3><b>How to choose between Cache and Databases?<\/b><\/h3>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Developers tend to overuse databases. But it is a bad practice as caches are much easier to implement. Databases are powerful but aren\u2019t required for many applications.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Most Common Ways to implement databases are <\/span><b>Realm<\/b><span style=\"font-weight: 400;\"> and <\/span><b>Core<\/b> <b>Data<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Some of the open-source implementations of cache are <\/span><b>NSURLCache<\/b><span style=\"font-weight: 400;\">, <\/span><b>PINCache<\/b><span style=\"font-weight: 400;\"> etc.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Caches can be used if you need a simple, lightweight solution. It can be used if logic to handle data from network call is already present and you want to just extend it to offline mode.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">You can use databases if you are sure that data isn\u2019t too large. Databases ease the search operations over a large record.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">But databases are difficult to implement and can cause crashes in apps if not implemented properly.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">The simplest way to implement cache is denormalized caches, where you could store the entire data tree in a single entry. It is the simplest way of caching<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">But this could cause inconsistencies, and in those cases, normalised caches can be used.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">It means the data tree is divided into many sub-models and each is cached separately with a unique ID.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Databases can be implemented by defining data models, loading data from network calls and then saving data to the database or updating it whenever required.<\/span><\/li>\n<\/ol>\n<h3><b>Different Options popularly used for offline local data handling in iOS:-<\/b><\/h3>\n<ol>\n<li style=\"font-weight: 400;\"><b>SQLite<\/b><span style=\"font-weight: 400;\">: It is shipped with iOS, and adds no overhead to the app. It requires developers to create and connect to Database, creates tables, inserts\/update\/delete rows.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Property List files<\/b><span style=\"font-weight: 400;\">: Documents can either be <\/span><span style=\"font-weight: 400;\">NSArray<\/span><span style=\"font-weight: 400;\"> or <\/span><span style=\"font-weight: 400;\">NSDictionary<\/span><span style=\"font-weight: 400;\"> type, inside which we can save data. Only NSArray, NSDictionary, <\/span><span style=\"font-weight: 400;\">NSString<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">NSDate<\/span><span style=\"font-weight: 400;\"> can be saved.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Core Data<\/b><span style=\"font-weight: 400;\">: It uses SQLite as its main database. All the data is saved in .<\/span><span style=\"font-weight: 400;\">db<\/span><span style=\"font-weight: 400;\"> files. This eliminates the need to install a separate database in your app. It provides an API to deal with common functionalities like save, delete etc. You have to create a data model (database schema), data model editor can be used to make the data model in .<\/span><span style=\"font-weight: 400;\">xcdatamodeld<\/span><span style=\"font-weight: 400;\"> file. Entity, Attributes, and relationships have to be defined. <\/span><span style=\"font-weight: 400;\">NSManagedObject<\/span><span style=\"font-weight: 400;\"> attributes can be written and read using Key-Value Coding. <\/span><span style=\"font-weight: 400;\">NSmanagedObjectContext<\/span><span style=\"font-weight: 400;\"> is needed to save and fetch data to and from Core Data.\u00a0\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>NSUserdefaults<\/b><span style=\"font-weight: 400;\">: It is used to save logged in users\u2019 state within the application. Can be used to save user\u2019s confidential information like access tokens. It can be used to store small amounts of data. The saved data can be accessed globally throughout the application. NSUserDefault caches the information, and we don\u2019t have to access the database for default values.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Key-Chain<\/b><span style=\"font-weight: 400;\">: This is generally avoided because data becomes vulnerable if the device is jail-broken.\u00a0<\/span><\/li>\n<\/ol>\n<h3><b>Core Data<\/b><span style=\"font-weight: 400;\">\u00a0<\/span><\/h3>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">To use Core data, it\u2019s important to enable the \u201cUse Core Data\u201d option. This will cause XCode to generate code for NSPersistentContainer.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">NSPersistentContainer helps manage Core data, facilitates saving and retrieving data.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">The first step in modelling data for Core data is to create a managed object model. The Data Model is similar to a database schema.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">In the .xcdatamodeld file, a data model editor can be found. Add Entity option of this editor can be used to create a new entity. To rename the entity double click it. An entity is a definition of a class for Core data.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">We can also define attributes for entities. Even relationships can be defined by two entities.\u00a0\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">To save data, NSManagedObject instances are used. It represents an object saved in Core data. NSManagedObject doesn\u2019t directly know about the attributes defined in the Data model. So, to read the data from Core data is through Key-Value pairing. <\/span>The below code shows a way to save and fetch data from Core data<\/li>\n<\/ol>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone wp-image-6323 size-full\" style=\"font-size: 1rem;\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image2-1.png\" alt=\"\" width=\"774\" height=\"84\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image2-1.png 774w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image2-1-300x33.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image2-1-768x83.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image2-1-624x68.png 624w\" sizes=\"(max-width: 774px) 100vw, 774px\" \/><\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-6324 size-full\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image6-1.png\" alt=\"\" width=\"705\" height=\"537\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image6-1.png 705w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image6-1-300x229.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image6-1-624x475.png 624w\" sizes=\"(max-width: 705px) 100vw, 705px\" \/><\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-6325 size-full\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image5-1.png\" alt=\"\" width=\"706\" height=\"373\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image5-1.png 706w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image5-1-300x158.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image5-1-624x330.png 624w\" sizes=\"(max-width: 706px) 100vw, 706px\" \/><\/p>\n<h3><b>UserDefaults<\/b><span style=\"font-weight: 400;\">\u00a0<\/span><\/h3>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">It was earlier known as NSUserDefalts. It is used to save small data in your app, like app settings, user\u2019s access token etc.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">UserDefault is a .plist file in your app and its structure is similar to a dictionary. So, the data is saved in Key-Value form.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Internally, it can only store NSData, NSString, NSNumber, NSDate, NSArray and NSDictionary only.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Before saving data or fetching it, the reference to the standard user defaults is required.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">The below code shows a way to save and fetch data :<\/span><\/li>\n<\/ol>\n<p>Code to save data:-<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6326 size-full\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image3-1.png\" alt=\"\" width=\"686\" height=\"92\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image3-1.png 686w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image3-1-300x40.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image3-1-624x84.png 624w\" sizes=\"(max-width: 686px) 100vw, 686px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Code to fetch data:-<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6327 size-full\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image4-1-1.png\" alt=\"\" width=\"756\" height=\"104\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image4-1-1.png 756w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image4-1-1-300x41.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image4-1-1-624x86.png 624w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Code to remove data:-<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6328 size-full\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image1-1.png\" alt=\"\" width=\"756\" height=\"41\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image1-1.png 756w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image1-1-300x16.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/image1-1-624x34.png 624w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><\/p>\n<h3><b>Conclusion<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">There are many different ways to achieve the offline data handling feature in an iOS app. It is important to consider and compare all of them before implementing them. I have covered a few in detail, please refer to the references for more detailed analysis.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">References<\/span><span style=\"font-weight: 400;\"> :<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><a href=\"https:\/\/medium.com\/device-blogs\/the-many-offline-options-for-ios-apps-2922c9b3bff3\"><span style=\"font-weight: 400;\">https:\/\/medium.com\/device-blogs\/the-many-offline-options-for-ios-apps-2922c9b3bff3<\/span><\/a><\/li>\n<li style=\"font-weight: 400;\"><a href=\"https:\/\/www.raywenderlich.com\/7569-getting-started-with-core-data-tutorial\"><span style=\"font-weight: 400;\">https:\/\/www.raywenderlich.com\/7569-getting-started-with-core-data-tutorial<\/span><\/a><\/li>\n<li style=\"font-weight: 400;\"><a href=\"https:\/\/www.raywenderlich.com\/6620276-sqlite-with-swift-tutorial-getting-started\"><span style=\"font-weight: 400;\">https:\/\/www.raywenderlich.com\/6620276-sqlite-with-swift-tutorial-getting-started<\/span><\/a><\/li>\n<li style=\"font-weight: 400;\"><a href=\"https:\/\/medium.com\/@zenshubham09\/offline-data-storage-in-ios-3e8dc68f6e3b\"><span style=\"font-weight: 400;\">https:\/\/medium.com\/@zenshubham09\/offline-data-storage-in-ios-3e8dc68f6e3b<\/span><\/a><\/li>\n<li style=\"font-weight: 400;\"><a href=\"https:\/\/learnappmaking.com\/userdefaults-swift-setting-getting-data-how-to\/\"><span style=\"font-weight: 400;\">https:\/\/learnappmaking.com\/userdefaults-swift-setting-getting-data-how-to\/<\/span><\/a><\/li>\n<li style=\"font-weight: 400;\"><a href=\"https:\/\/developer.apple.com\/documentation\/foundation\/userdefaults\"><span style=\"font-weight: 400;\">https:\/\/developer.apple.com\/documentation\/foundation\/userdefaults<\/span><\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Why Offline handling? Offline data handling in iOS apps isn\u2019t an extra feature anymore. Users want and expect it as a default feature in apps. So it is necessary to save data in our apps.\u00a0 Data from researches and surveys show that users abandon pages if they take more than 3 seconds to load. This [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6329,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[14,548],"class_list":["post-6322","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ios","tag-innovationm","tag-offline-data-handling-in-ios"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Offline data handling in iOS - InnovationM - Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Offline data handling in iOS - InnovationM - Blog\" \/>\n<meta property=\"og:description\" content=\"Why Offline handling? Offline data handling in iOS apps isn\u2019t an extra feature anymore. Users want and expect it as a default feature in apps. So it is necessary to save data in our apps.\u00a0 Data from researches and surveys show that users abandon pages if they take more than 3 seconds to load. This [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/\" \/>\n<meta property=\"og:site_name\" content=\"InnovationM - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-23T10:14:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-20T13:25:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/Offline-data-handling-in-iOS.png\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"InnovationM Admin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InnovationM Admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/offline-data-handling-in-ios\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/offline-data-handling-in-ios\\\/\"},\"author\":{\"name\":\"InnovationM Admin\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"headline\":\"Offline data handling in iOS\",\"datePublished\":\"2020-10-23T10:14:55+00:00\",\"dateModified\":\"2023-01-20T13:25:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/offline-data-handling-in-ios\\\/\"},\"wordCount\":978,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/offline-data-handling-in-ios\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/Offline-data-handling-in-iOS.png\",\"keywords\":[\"InnovationM\",\"Offline data handling in iOS\"],\"articleSection\":[\"iOS\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/offline-data-handling-in-ios\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/offline-data-handling-in-ios\\\/\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/offline-data-handling-in-ios\\\/\",\"name\":\"Offline data handling in iOS - InnovationM - Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/offline-data-handling-in-ios\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/offline-data-handling-in-ios\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/Offline-data-handling-in-iOS.png\",\"datePublished\":\"2020-10-23T10:14:55+00:00\",\"dateModified\":\"2023-01-20T13:25:14+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/offline-data-handling-in-ios\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/offline-data-handling-in-ios\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/offline-data-handling-in-ios\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/Offline-data-handling-in-iOS.png\",\"contentUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/Offline-data-handling-in-iOS.png\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/offline-data-handling-in-ios\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Offline data handling in iOS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\",\"name\":\"InnovationM - Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\",\"name\":\"InnovationM Admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"caption\":\"InnovationM Admin\"},\"sameAs\":[\"http:\\\/\\\/www.innovationm.com\\\/\"],\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/author\\\/innovationmadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Offline data handling in iOS - InnovationM - Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/","og_locale":"en_US","og_type":"article","og_title":"Offline data handling in iOS - InnovationM - Blog","og_description":"Why Offline handling? Offline data handling in iOS apps isn\u2019t an extra feature anymore. Users want and expect it as a default feature in apps. So it is necessary to save data in our apps.\u00a0 Data from researches and surveys show that users abandon pages if they take more than 3 seconds to load. This [&hellip;]","og_url":"https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/","og_site_name":"InnovationM - Blog","article_published_time":"2020-10-23T10:14:55+00:00","article_modified_time":"2023-01-20T13:25:14+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/Offline-data-handling-in-iOS.png","type":"image\/png"}],"author":"InnovationM Admin","twitter_misc":{"Written by":"InnovationM Admin","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/#article","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/"},"author":{"name":"InnovationM Admin","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"headline":"Offline data handling in iOS","datePublished":"2020-10-23T10:14:55+00:00","dateModified":"2023-01-20T13:25:14+00:00","mainEntityOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/"},"wordCount":978,"commentCount":0,"image":{"@id":"https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/Offline-data-handling-in-iOS.png","keywords":["InnovationM","Offline data handling in iOS"],"articleSection":["iOS"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/","url":"https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/","name":"Offline data handling in iOS - InnovationM - Blog","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/#primaryimage"},"image":{"@id":"https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/Offline-data-handling-in-iOS.png","datePublished":"2020-10-23T10:14:55+00:00","dateModified":"2023-01-20T13:25:14+00:00","author":{"@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"breadcrumb":{"@id":"https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/#primaryimage","url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/Offline-data-handling-in-iOS.png","contentUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/10\/Offline-data-handling-in-iOS.png","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/www.innovationm.com\/blog\/offline-data-handling-in-ios\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.innovationm.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Offline data handling in iOS"}]},{"@type":"WebSite","@id":"https:\/\/www.innovationm.com\/blog\/#website","url":"https:\/\/www.innovationm.com\/blog\/","name":"InnovationM - Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.innovationm.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed","name":"InnovationM Admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","caption":"InnovationM Admin"},"sameAs":["http:\/\/www.innovationm.com\/"],"url":"https:\/\/www.innovationm.com\/blog\/author\/innovationmadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/6322","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/comments?post=6322"}],"version-history":[{"count":0,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/6322\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media\/6329"}],"wp:attachment":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media?parent=6322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/categories?post=6322"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/tags?post=6322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}