{"id":6627,"date":"2021-02-25T12:17:03","date_gmt":"2021-02-25T06:47:03","guid":{"rendered":"https:\/\/www.innovationm.com\/blog\/?p=6627"},"modified":"2023-01-20T18:55:08","modified_gmt":"2023-01-20T13:25:08","slug":"ios-force-update","status":"publish","type":"post","link":"https:\/\/www.innovationm.com\/blog\/ios-force-update\/","title":{"rendered":"iOS Force Update"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">In iOS apps, it\u2019s important that developers create a way to check the user\u2019s app version and force the user to update the app. This solution not only requires code handling at the app level but also in the app backend. This solution will help in migrating all users to new functionality smoothly.\u00a0\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The default App Store setting to automatically download app updates can be really helpful in the majority of the cases. But in some situations, when the update is urgent and not optional, developers need to have an in-built mechanism to force users to update their apps. In apps, it\u2019s not easy to move users to earlier\/older versions. So, in cases, if some issues occur in the app&#8217;s latest version which requires urgent and mandatory updates, these mechanisms can be really helpful.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Exceptional scenarios aside, this mechanism can also help in improving users\u2019 overall experience. Users\u2019 can be easily updated to new versions with the latest features and bug fixes.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Apple default mechanisms have a great pull factor to encourage users to update to the latest version of iOS. iOS through badging\/notifications informs the user about the latest OS\u00a0 versions. Developers rarely need to worry about giving support to very old iOS versions. This really helps if the app supports only a few latest released versions of iOS. Also, users will only be able to see the latest update their device is eligible for. This reduces risk if the latest app versions only support the latest iOS releases and the team wishes to drop their support for older OS versions. But in this case, too, letting the user know about the latest app updates can be really helpful.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It\u2019s important that this force update feature is included even in the very first version of the app. Otherwise, forcing all users to upgrade won\u2019t be possible in later stages.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The first step includes getting the latest app version from your backend API. In the next step, developers need to fetch the current app version. Then these two versions should be compared. If the version is found to be older then, redirect the user to the app store.<\/span><\/p>\n<p><strong>To get the app version, use the below-mentioned code :<\/strong><\/p>\n<pre class=\"lang:default decode:true \">let version = Bundle.main.object(forInfoDictionaryKey: \"CFBundleShortVersionString\") as? String<\/pre>\n<p><strong>To send the user to an app store, use the following code :<\/strong><\/p>\n<pre class=\"lang:default decode:true \">if let url = URL(string: \"itms-apps:\/\/apple.com\/app\/App_Store_Id) {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0UIApplication.shared.open(url)\r\n\r\n\u00a0}<\/pre>\n<p><span style=\"font-weight: 400;\">Another Way to achieve force update is through Updates open-source framework. This provides functionality to automatically check newer versions of the app. It presents the newer version number and other information regarding the latest update.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Updates use iTunes Search API to get the latest version of your app available from the app store. It also fetches the additional information provided by the development team for the latest release. This informs the user about the latest features too.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This framework also automatically ensures that the app update is for the relevant App Store location\/country.<\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If a user elects to update then, the framework can present the App store using SKStoreProductViewController. This makes the developers\u2019 tasks simple and the user experience smooth.<\/span><\/p>\n<p><strong>To configure this framework use the following code. The configuration is done using a JSON configuration file from a URL, or a local file in the app.<\/strong><\/p>\n<pre class=\"lang:default decode:true \">let URL = \"https:\/\/domainname.com\/file.json\"\r\n\r\nUpdates.configurationURL = URL(string: URL)\r\n\r\n\r\n(or)\r\n\r\n\r\nUpdates.configurationURL = Bundle.main.url(forResource: \u201cFilename,\u201d withExtension: \"json\")<\/pre>\n<p><strong>A configuration file may look something similar to the below text :<\/strong><\/p>\n<pre class=\"lang:default decode:true \">{\r\n\r\n\u00a0\u00a0\u00a0\u00a0\"updates\": {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"check-for\": \"automatically\",\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"notify\": \"once\"\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n}<\/pre>\n<p><span style=\"font-weight: 400;\">The framework looks for a top-level key \u201cupdates\u201d, for \u201cnotify\u201d key, other than \u201conce\u201d, \u201ctwice\u201d, \u201cthrice\u201d, \u201calways\u201d etc. values can also be used.<\/span><\/p>\n<p><strong>The configuration can also be done programmatically, this let go of the need for a JSON file.\u00a0<\/strong><\/p>\n<pre class=\"lang:default decode:true \">Updates.updatingMode = .automatically\r\n\r\nUpdates.notifying = .always<\/pre>\n<p><strong>Conclusion :<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">It is advised for developers to plan for any need to migrate users to the latest version of an app. The Update framework provides for the automatic query of the latest version of the app and can also display the alert to the user.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In iOS apps, it\u2019s important that developers create a way to check the user\u2019s app version and force the user to update the app. This solution not only requires code handling at the app level but also in the app backend. This solution will help in migrating all users to new functionality smoothly.\u00a0\u00a0 The default [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6628,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,380,576],"tags":[14,581],"class_list":["post-6627","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ios","category-swift-5","category-xcode-12","tag-innovationm","tag-ios-force-update"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>iOS Force Update - 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\/ios-force-update\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"iOS Force Update - InnovationM - Blog\" \/>\n<meta property=\"og:description\" content=\"In iOS apps, it\u2019s important that developers create a way to check the user\u2019s app version and force the user to update the app. This solution not only requires code handling at the app level but also in the app backend. This solution will help in migrating all users to new functionality smoothly.\u00a0\u00a0 The default [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.innovationm.com\/blog\/ios-force-update\/\" \/>\n<meta property=\"og:site_name\" content=\"InnovationM - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-02-25T06:47:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-20T13:25:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/02\/iOS-Force-Update.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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-force-update\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-force-update\\\/\"},\"author\":{\"name\":\"InnovationM Admin\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"headline\":\"iOS Force Update\",\"datePublished\":\"2021-02-25T06:47:03+00:00\",\"dateModified\":\"2023-01-20T13:25:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-force-update\\\/\"},\"wordCount\":634,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-force-update\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/iOS-Force-Update.png\",\"keywords\":[\"InnovationM\",\"iOS Force Update\"],\"articleSection\":[\"iOS\",\"Swift 5\",\"Xcode 12\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-force-update\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-force-update\\\/\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-force-update\\\/\",\"name\":\"iOS Force Update - InnovationM - Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-force-update\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-force-update\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/iOS-Force-Update.png\",\"datePublished\":\"2021-02-25T06:47:03+00:00\",\"dateModified\":\"2023-01-20T13:25:08+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-force-update\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-force-update\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-force-update\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/iOS-Force-Update.png\",\"contentUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/iOS-Force-Update.png\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-force-update\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"iOS Force Update\"}]},{\"@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":"iOS Force Update - 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\/ios-force-update\/","og_locale":"en_US","og_type":"article","og_title":"iOS Force Update - InnovationM - Blog","og_description":"In iOS apps, it\u2019s important that developers create a way to check the user\u2019s app version and force the user to update the app. This solution not only requires code handling at the app level but also in the app backend. This solution will help in migrating all users to new functionality smoothly.\u00a0\u00a0 The default [&hellip;]","og_url":"https:\/\/www.innovationm.com\/blog\/ios-force-update\/","og_site_name":"InnovationM - Blog","article_published_time":"2021-02-25T06:47:03+00:00","article_modified_time":"2023-01-20T13:25:08+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/02\/iOS-Force-Update.png","type":"image\/png"}],"author":"InnovationM Admin","twitter_misc":{"Written by":"InnovationM Admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.innovationm.com\/blog\/ios-force-update\/#article","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/ios-force-update\/"},"author":{"name":"InnovationM Admin","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"headline":"iOS Force Update","datePublished":"2021-02-25T06:47:03+00:00","dateModified":"2023-01-20T13:25:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/ios-force-update\/"},"wordCount":634,"commentCount":0,"image":{"@id":"https:\/\/www.innovationm.com\/blog\/ios-force-update\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/02\/iOS-Force-Update.png","keywords":["InnovationM","iOS Force Update"],"articleSection":["iOS","Swift 5","Xcode 12"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.innovationm.com\/blog\/ios-force-update\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.innovationm.com\/blog\/ios-force-update\/","url":"https:\/\/www.innovationm.com\/blog\/ios-force-update\/","name":"iOS Force Update - InnovationM - Blog","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/ios-force-update\/#primaryimage"},"image":{"@id":"https:\/\/www.innovationm.com\/blog\/ios-force-update\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/02\/iOS-Force-Update.png","datePublished":"2021-02-25T06:47:03+00:00","dateModified":"2023-01-20T13:25:08+00:00","author":{"@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"breadcrumb":{"@id":"https:\/\/www.innovationm.com\/blog\/ios-force-update\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.innovationm.com\/blog\/ios-force-update\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.innovationm.com\/blog\/ios-force-update\/#primaryimage","url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/02\/iOS-Force-Update.png","contentUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/02\/iOS-Force-Update.png","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/www.innovationm.com\/blog\/ios-force-update\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.innovationm.com\/blog\/"},{"@type":"ListItem","position":2,"name":"iOS Force Update"}]},{"@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\/6627","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=6627"}],"version-history":[{"count":0,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/6627\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media\/6628"}],"wp:attachment":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media?parent=6627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/categories?post=6627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/tags?post=6627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}