Search Your Question

iOS 15 Release date , features - All answers related to iOS 15


iOS 15 Release date , features



FAQ for iOS 15


Q. Which is latest iOS version?
A. iOS 15 is latest iOS Version.

Q. What is iOS 15 release date?
A. iOS 15 is released on 20 September, 2021 worldwide.

Q. Is there any version after iOS 15 ?
A. iOS 15.1 beta version is released on 21 September, 2021.

Q. What is iOS 15 release date in India?
A. iOS 15 is released on 20 Sepember, 2021 in India.

How to install iOS 15 now


Step 1: Goto settings menu in iPhone

Step 2: Scroll down and tap on General

Step 3: Check if iOS 15 update is there or not.

Step 4: If yes, tap on the Download option displayed on the screen.

Step 5: Apple also provides the option to install the update while you are asleep. Select the best-suited option and install the iOS 15 update.

Once the iOS 15 update is installed, your iPhone will boot up. It will take some time due to update size is almost 3 GB. Before starting with the installation process, below are a few tips to keep in mind.

Tips to keep in mind before installing iOS 15

–Connect your iOS Device with stable high speed wifi.

–As iOS 15 update is almost 3 GB update, keep such space in memory

–Installation will take around half an hour. So keep your iOS device in charging mode.


Important features in iOS 15 updates for daily usse


  • Facetime

iOS 15 includes a new features for FaceTime. It will help apple to compete with other online meeting service like JioMeet, Zoom, Microsoft Team, etc.

Features in Facetime:
Spatial Audio support
Portrait mode for videos
Grid view for videos
Join FaceTime calls from the web on Android and Windows
FaceTime links
SharePlay for sharing content during FaceTime, including screen sharing, music, and more

  • Messages

Apple has also announced new features for Messages, including new ways to easily access content that people send you. Shared Stacks will bring over content from Messages to Photos app.

  • Notifications


Notification design is changed and anyone can choose to view summary.
When you enable DND, your status will be shown to other people via the Messages app
Notification design has been changed with large icons.
You can set different “Focus” status that change your Home Screen, notification preferences, and more.

  • Photos

Photos app now includes OCR capability. Due to this, it enables covert from image to text with artificial intelligence.
Photos can also be searched in spotlight. So it can be easily searched.

  • Weather

The Weather app has been revamped with lots of new data.
Layout design of the Weather app changes based on the weather in your current location.

  • Safari

iOS 15 brings a completely new design to Safari. Controls are brought to the bottom of the screen so that they are easier to reach with one hand.

There is a new, compact tab bar that floats at the bottom of the screen so that users can easily swipe between tabs, and it also contains a Smart Search field. Tab Groups allow users to save their tabs in a folder and sync across the iPhone, iPad, and Mac. In addition, there is a new tab overview grid view.

Users can simply pull down a web page to refresh it and there is now support for voice search. Safari also gains a customizable start page and mobile web extensions for the first time.


These are some important features that normal users can see changes. Otherwise apple has changed in many in-built application but it is not daily use for every people.

If you have any doubt or any question related iOS 15 release, please comment on box below.

What is push notification payload maximum size?

Apple Push Notification service (APNs) refuses a notification if the total size of its payload exceeds the following limits:

  • FCM - 2 Kb
  • VOIP Notification - 5 kb
  • For all other remote notification - 4 kb

What is trailing closure?

 If the last parameter to a function is a closure, Swift lets you use special syntax called trailing closure syntax. Rather than pass in your closure as a parameter, you pass it directly after the function inside braces.

To demonstrate this, here’s our travel() function again. It accepts an action closure so that it can be run between two print() calls:

func travel(action: () -> Void) {

    print("I'm getting ready to go.")

    action()

    print("I arrived!")

}

Because its last parameter is a closure, we can call travel() using trailing closure syntax like this:

travel() {

    print("I'm driving in my car")

}

In fact, because there aren’t any other parameters, we can eliminate the parentheses entirely:

travel {

    print("I'm driving in my car")

}

Trailing closure syntax is extremely common in Swift, so it’s worth getting used to.

Difference between method and function

Methods belong to classes, structs, and enums, whereas functions do not.

Methods always belong to a data type, they have a concept of self that functions do not. This is a special value passed in by Swift, and it refers to whatever instance the method was called on.

Swift uses the same keyword, func, for both functions and methods.

Difference between type method and Instance method?

Type Method: We can call the method using Struct, Class, or Enum name. The method can be static or Class for making such methods. Static method can not be override but class method can be override.

Instance Method: We can call normal method using making instance of strcut or class. This methods are called instance method.

Difference between Swift and Objective C

 


 SWIFT  

 OBJECTIVE C


Swift is a general-purpose, high-level programming language that is highly concerned about safety, and performance.

Objective C is a general-purpose language that is considered a superset of C language it was designed with the aim of providing object-oriented capabilities.


It was developed by Chris Lattner with eventual collaboration with other programmers at Apple.

It was developed by Brad Cox and Tom Love at their company Stepstone.


It was influenced by Objective C, Rust, Ruby, and Python.

It was influenced by C and Smalltalk.


Swift first appeared on the year 2014.

Objective C first appeared on the year 1984.


Swift is a static type.

Objective C is dynamic type.


Swift is apache licensed open-source project.

Objective C is licensed under General Public License.


It only has classes.

It has both Structs and classes.


It was designed for building apps for iOS, Mac, Apple TV, and Apple Watch.

Objective C was designed to be Smalltalk messaging features.


Swift polymorphism does not exist directly.

Polymorphism in Objective C exists directly in compile time.


It uses true and false values.

It uses YES and NO values and also BOOl.


Swift has multiple types of templates than Objective C.

Objective C lacks templates than Swift.

What is remote config in firebase

Change the behavior and appearance of your app without publishing an app update, at no cost, for unlimited daily active users.

Firebase Remote Config is a cloud service that lets you change the behavior and appearance of your app without requiring users to download an app update. When using Remote Config, you create in-app default values that control the behavior and appearance of your app. Then, you can later use the Firebase console or the Remote Config backend APIs to override in-app default values for all app users or for segments of your user base. Your app controls when updates are applied, and it can frequently check for updates and apply them with a negligible impact on performance.

What is KVO?

Key-value observing is the ability for Swift to attach code to variables, so that whenever the variable is changed the code runs. It’s similar to property observers (willSet and didSet ), except KVO is for adding observers outside of the type definition.


KVO isn’t terribly nice in pure Swift code, because it relies on the Objective-C runtime – you need to use @objc classes that inherit from NSObject, then mark each of your properties with @objc dynamic.


For example, we could create a Car class like this:


@objc class Car: NSObject {

    @objc dynamic var name = "BMW"

}


let bmw= Car()

You could then observe that user’s name changing like this:


bmw.observe(\Car.name, options: .new) { car, change in

    print("I'm now called \(car.name)")

}

That asks BMW to watch for new values coming in, then prints the person’s name as soon as the new value is set.


To try it out, just change the car's name to something else:


bmw.name = "Mercedese"

That will print “I’m now called Mercedese.”


Although KVO is unpleasant in pure Swift code, it’s better when working with Apple’s own APIs – they are all automatically both @objc and dynamic because they are written in Objective-C.


However, one warning: even though large parts of UIKit might work with KVO, this is a coincidence rather than a promise – Apple makes no guarantees about UIKit remaining KVO-compatible in the future.

What is Protocol Oriented Programming?

Protocol-Oriented Programming is a new programming paradigm ushered in by Swift 2.0. In the Protocol-Oriented approach, we start designing our system by defining protocols. We rely on new concepts: protocol extensions, protocol inheritance, and protocol compositions.

In Swift, value types are preferred over classes. However, object-oriented concepts don’t work well with structs and enums: a struct cannot inherit from another struct, neither can an enum inherit from another enum. 

On the other hand, value types can inherit from protocols, even multiple protocols. Thus, with POP, value types have become first-class citizens in Swift.

Pillars of POPs

Protocol Extensions
Protocols serve as blueprints: they tell us what adopters shall implement, but you can’t provide implementation within a protocol. What if we need to define default behavior for conforming types? We need to implement it in a base class, right? Wrong! Having to rely on a base class for default implementation would eclipse the benefits of protocols. Besides, that would not work for value types. Luckily, there is another way: protocol extensions are the way to go! In Swift, you can extend a protocol and provide a default implementation for methods, computed properties, subscripts, and convenience initializers. In the following example, I provided default implementation for the type method uid().

extension Entity {
    static func uid() -> String {
        return UUID().uuidString
    }
}
swift
Now types that adopt the protocol need not implement the uid() method anymore.

struct Order: Entity {
    var name: String
    let uid: String = Order.uid()
}
let order = Order(name: "My Order")
print(order.uid)
// 4812B485-3965-443B-A76D-72986B0A4FF4

Protocol Inheritance

A protocol can inherit from other protocols and then add further requirements on top of the requirements it inherits. In the following example, the protocol Persistable inherits from the Entity protocol I introduced earlier. It adds the requirement to save an entity to file and load it based on its unique identifier.

protocol Persistable: Entity {
    func write(instance: Entity, to filePath: String)
    init?(by uid: String)
}
swift
The types that adopt the Persistable protocol must satisfy the requirements defined in both the Entity and the Persistable protocol.

If your type requires persistence capabilities, it should implement the Persistable protocol.

struct PersistableEntity: Persistable {
    var name: String
    func write(instance: Entity, to filePath: String) { // ...
    }  
    init?(by uid: String) {
        // try to load from the filesystem based on id
    }
}
swift
Whereas types that do not need to be persisted shall only implement the Entity protocol:

struct InMemoryEntity: Entity {
    var name: String
}

Protocol inheritance is a powerful feature that allows for more granular and flexible designs.

Protocol Composition

Swift does not allow multiple inheritances for classes. However, Swift types can adopt multiple protocols. Sometimes you may find this feature useful.

Here’s an example: let’s assume that we need a type that represents an Entity.

We also need to compare instances of a given type. And we want to provide a custom description, too.

We have three protocols that define the mentioned requirements:

Entity
Equatable
CustomStringConvertible
If these were base classes, we’d have to merge the functionality into one superclass; however, with POP and protocol composition, the solution becomes:

struct MyEntity: Entity, Equatable, CustomStringConvertible {
    var name: String
    // Equatable
    public static func ==(lhs: MyEntity, rhs: MyEntity) -> Bool {
        return lhs.name == rhs.name
    }
    // CustomStringConvertible
    public var description: String {
        return "MyEntity: \(name)"
    }
}
let entity1 = MyEntity(name: "42")
print(entity1)
let entity2 = MyEntity(name: "42")
assert(entity1 == entity2, "Entities shall be equal")

This design not only is more flexible than squeezing all the required functionality into a monolithic base class but also works for value types.

Difference between compact map and Flat map

Compact Map :

Use this method to receive an array of nonoptional values when your transformation produces an optional value.

let scores = ["1", "2", "three", "four", "5"]

let mapped: [Int?] = scores.map { str in Int(str) }
// [1, 2, nil, nil, 5] - Two nil values as "three" and "four" are strings.

let compactMapped: [Int] = scores.compactMap { str in Int(str) } 

// [1, 2, 5] - The nil values for "three" and "four" are filtered out. 

Flat Map :

Use this method to receive a single-level collection when your transformation produces a sequence or collection for each element.

Map vs FlatMap
let scoresByName = ["Henk": [0, 5, 8], "John": [2, 5, 8]]

let mapped = scoresByName.map { $0.value }
// [[0, 5, 8], [2, 5, 8]] - An array of arrays
print(mapped)

let flatMapped = scoresByName.flatMap { $0.value }
// [0, 5, 8, 2, 5, 8] - flattened to only one array

CompactMap vs FlatMap

Used on a sequence and having a transformation returning an optional value, use CompactMap. If not, either map or flatMap should give you the results you need.

How to switch from background queue to main queue?

If you're on a background thread and want to execute code on the main thread, you need to call async() again. However, this time, you do it on DispatchQueue.main, which is the main thread, rather than one of the global quality of service queues.


DispatchQueue.global(qos: .userInitiated).async {

    if let url = URL(string: urlString) {

        if let data = try? Data(contentsOf: url) {

            self.parse(json: data)

            return

        }

    }

    self.showError()

}


func showError() {

    DispatchQueue.main.async {

        let ac = UIAlertController(title: "Loading error", message: "There was a problem loading the feed; please check your connection and try again.", preferredStyle: .alert)

        ac.addAction(UIAlertAction(title: "OK", style: .default))

        self.present(ac, animated: true)

    }

}


Sof here, If I want to work with UI-related stuff, I must switch queue to main. So to execute that code under  DispatchQueue.main.async { } block.

Difference between FCM and APNS

  • FCM is sent as JSON payloads and APNS sends either string or dictionary.
  • FCM has a payload of 2KB while APNS has a payload of 4KB.
  • APNS saves 1 notification per App while FCM saves 100 notifications per device.
  • FCM supports multiple platforms while APNS requires their proprietary platform.
  • Acknowledgment can be sent in FCM if using XMPP, but it's not possible on APNS.

Advatage of FCM

  • Even if the user disallows notification, you can notify your app if the app is running in the foreground (using shouldEstablishDirectChannel).
  • Don't need to create dashboard to send notification on the device.
  • Notification analytics on FCM Dashboard.
  • Easy to create notification payload structure.
  • App Server side handling is easy, Only one key is required for multiple apps and platform (iOS, Android, Web)

GIT Interview Questions 2

  1. GIT Commit command
    The command that is used to write a commit message is “git commit -a”
    Now explain about -a flag by saying -a on the command line instructs git to commit the new content of all tracked files that have been modified. Also, mention you can use “git add <file>” before git commit -a if new files need to be committed for the first time.

  2. How can you fix a broken commit?
    In order to fix any broken commit, use the command “git commit --amend”. When you run this command, you can fix the broken commit message in the editor.

  3.  Basic Git commands:

    CommandFunction
    git rm [file]deletes the file from your working directory and stages the deletion.
    git log list the version history for the current branch.

    git show [commit]  

    shows the metadata and content changes of the specified commit.

    git tag [commitID] 

    used to give tags to the specified commit.

    git checkout [branch name]

    git checkout -b [branch name]

    used to switch from one branch to another.

    creates a new branch and also switches to it.



  4. In Git how do you revert a commit that has already been pushed and made public?
    There can be two approaches to tackle this question and make sure that you include both because any of the below options can be used depending on the situation:

    Remove or fix the bad file in a new commit and then push it to the remote repository. This is the most obvious way to fix an error. Once you have made necessary changes to the file, then commit it to the remote repository using the command: git commit -m “commit message”

    Also, you can create a new commit that undoes all changes that were made in the bad commit. To do this use the command

    git revert <name of bad commit>

  5. What is the difference between git pull and git fetch?
    Git pull command pulls new changes or commits from a particular branch from your central repository and updates your target branch in your local repository.

    Git fetch is also used for the same purpose but it works in a slightly different way. When you perform a git fetch, it pulls all new commits from the desired branch and stores it in a new branch in your local repository. If you want to reflect these changes in your target branch, git fetch must be followed with a git merge. Your target branch will only be updated after merging the target branch and fetched branch. Just to make it easy for you, remember the equation below:

    Git pull = git fetch + git merge

  6. What is git stash?
    Often, when you’ve been working on part of your project, things are in a messy state and you want to switch branches for some time to work on something else. The problem is, you don’t want to do a commit of half-done work just so you can get back to this point later. The answer to this issue is Git stash.

    Stashing takes your working directory that is, your modified tracked files and staged changes and saves it on a stack of unfinished changes that you can reapply at any time.

  7. What is the function of ‘git stash apply’?
    If you want to continue working where you had left your work then ‘git stash apply‘ command is used to bring back the saved changes onto your current working directory.

  8. What is git stash drop?
    Git ‘stash drop’ command is used to remove the stashed item. It will remove the last added stash item by default, and it can also remove a specific item if you include it as an argument.

    Now give an example.

    If you want to remove a particular stash item from the list of stashed items you can use the below commands:
  • git stash list: It will display the list of stashed items like:
  • stash@{0}: WIP on master: 049d078 added the index file
  • stash@{1}: WIP on master: c264051 Revert “added file_size”
  • stash@{2}: WIP on master: 21d80a5 added number to log

    If you want to remove an item named stash@{0} use command git stash drop stash@{0}.

  1. Can you explain the Gitflow workflow?
    To record the history of the project, Gitflow workflow employs two parallel long-running branches – master and develop:

    Master – this branch is always ready to be released on LIVE, with everything fully tested and approved (production-ready).

    Hotfix – these branches are used to quickly patch production releases. These branches are a lot like release branches and feature branches except they’re based on master instead of develop.

    Develop – this is the branch to which all feature branches are merged and where all tests are performed. Only when everything’s been thoroughly checked and fixed it can be merged to the master.

    Feature – each new feature should reside in its own branch, which can be pushed to the develop branch as their parent one.

  2. What is Git fork? What is the difference between fork, branch, and clone?
    A fork is a copy of a repository. Normally you fork a repository so that you are able to freely experiment with changes without affecting the original project. Most commonly, forks are used to either propose changes to someone else’s project or to use someone else’s project as a starting point for your own idea.

    git cloning means pointing to an existing repository and make a copy of that repository in a new directory, at some other location. The original repository can be located on the local file system or on remote machine accessible supported protocols. The git clone command is used to create a copy of an existing Git repository.

    In very simple words, git branches are individual projects within a git repository. Different branches within a repository can have completely different files and folders, or it could have everything the same except for some lines of code in a file.

  3. What is the difference between rebasing and merge in Git?
    In Git, the rebase command is used to integrate changes from one branch into another. It is an alternative to the “merge” command. The difference between rebasing and merge is that rebase rewrites the commit history in order to produce a straight, linear succession of commits.

    Merging is Git’s way of putting a forked history back together again. The git merge command helps you take the independent lines of development created by git branch and integrate them into a single branch.

  4. What is git cherry-pick?
    The command git cherry-pick is normally used to introduce particular commits from one branch within a repository onto a different branch. Another common use is to forward- or back-port commits from a maintenance branch to a development branch. This is in contrast with other ways such as merge and rebase which normally apply many commits onto another branch.

    Consider:

    git cherry-pick <commit-hash>

  5. How do you squash the last N commits into a single commit?
    There are two options to squash the last N commits into a single commit include both of the below-mentioned options in your answer
    If you want to write the new commit message from scratch use the following command

    git reset –soft HEAD~N &&git commit

    If you want to start editing the new commit message with a concatenation of the existing commit messages then you need to extract those messages and pass them to Git commit for that I will use

    git reset –soft HEAD~N &&git commit –edit -m”$(git log –format=%B –reverse .HEAD@{N})”

  6. How do I rename a local Git branch?
    Here are the steps to rename the branch:

    Switch to the branch which needs to be renamed

    git branch -m <new_name>
    git push origin :<old_name>
    git push origin <new_name>:refs/heads/<new_name>

Difference between MVC and Viper architecture

What is MVVM?

MVVM - Model View ViewModel

Advantage : 

Better Separation of Concerns
In a project built with the Model-View-Controller pattern, you are often faced with the question which code goes where. Code that doesn’t fit or belong in the model or view layer is often put in the controller layer. This inevitably leads to fat controllers that are difficult to test and manage.

The MVVM pattern presents a better separation of concerns by adding view models to the mix. The view model translates the data of the model layer into something the view layer can use. The controller is no longer responsible for this task.

Improved Testability
View controllers are notoriously hard to test because of their relation to the view layer. By migrating data manipulation to the view model, testing becomes much easier. Testing view models is easy. Because a view model doesn’t have a reference to the object it is owned by, it easy to write unit tests for a view model.

Another, and often overlooked, benefit of MVVM is improved testability of view controllers. The view controller no longer depends on the model layer, which makes them easier to test.

Transparent Communication
The responsibilities of the view controller are reduced to controlling the interaction between the view layer and the model layer, glueing both layers together.

The view model provides a transparent interface to the view controller, which it uses to populate the view layer and interact with the model layer. This results in a transparent communication between the four layers of your application.

There are some rules you know when using MVVM

Rule1 : The view does not know about the controller it is owned by. Remember that views are supposed to be dumb. They only know how to present the data they are given to the user.
Rule 2 : The controller does not know about the model. This is what separates MVC from MVVM.
Rule 3 : The model does not know about the view model it is owned by.
Rule 4 : The view model owns the model. When using the Model-View-Controller pattern, the model is usually owned by the controller.
Rule 5 : The view controller owns the view. This relationship remains unchanged when using the Model-View-ViewModel pattern.
Rule 6 : And, finally, the controller owns the view model. It interacts with the model layer through one or more view models.

Download task when app is inactive

 https://developer.apple.com/documentation/foundation/url_loading_system/downloading_files_in_the_background


For the background download, there is beginBackgroundTaskWithExpirationHandler: that is specifically designed to do that. When you use it, you will get few more minutes to execute whatever you need (after that limit, your application will get terminated no matter what).

You can write following methods:

func beginBackgroundTask() -> UIBackgroundTaskIdentifier {
    return UIApplication.sharedApplication().beginBackgroundTaskWithExpirationHandler({})
}

func endBackgroundTask(taskID: UIBackgroundTaskIdentifier) {
    UIApplication.sharedApplication().endBackgroundTask(taskID)
}

When you want to use it, you just simple begin / end the task when starting / finishing the download call:

// Start task
let task = self.beginBackgroundTask()

// Do whatever you need
self.someBackgroundTask()

// End task
self.endBackgroundTask(task)

Hope it helps!

What is SSL Pinning and How to implement it?

SSL stands for Secure Socket Layer, which is a protocol for creating an encrypted connection between client and server. It ensures that all data pass in network will be private and integral.

How SSL works? When client establishes the connection with server (called SSL handshake):

  1. Client connects to server and requests server identify itself.
  2. Server sends certificate to client (include public key)
  3. Client checks if that certificate is valid. If it is, client creates a symmetric key (session key), encrypts with public key, then sends back to server
  4. Server receives encrypted symmetric key, decrypts by its private key, then sends acknowledge packet to client
  5. Client receives ACK and starts the session

Using SSL, the client will allow the connection only from trusted sources that have the valid certificate. And it looks good for most cases. But what if someone stands between client and server, and acts like they are the real server? Let's call client is C, server is S and the attacker is A.

In step 1, instead of sending packet to S, A can catch the packet and pretend it as S. What if instead of receiving certificate from S, client C will receive fake certificate from A and believe it's valid. A can make C think that it is communicating with S, but actually all connection flows will be directed to attacker A.

Hence, SSL pinning can be the solution to prevent Man-In-The-Middle (MITM) attack. SSL pinning will ensure that client connect with designated server. The main key of SSL pinning that server certificate will be saved in app bundle. Then, when client receives certificate from server, it then compares 2 certificates to make sure that they are the same before establishing the connection.

URLSession

For NSURLSession, the main method to handle SSL pinning is URLSession:didReceiveChallenge:completionHandler:delegate. Set your class to conform URLSessionDelegate and paste this function to your class:


func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
    if (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust) {
        if let serverTrust = challenge.protectionSpace.serverTrust {
            var secresult = SecTrustResultType.invalid
            let status = SecTrustEvaluate(serverTrust, &secresult)
            
            if (errSecSuccess == status) {
                if let serverCertificate = SecTrustGetCertificateAtIndex(serverTrust, 0) {
                    let serverCertificateData = SecCertificateCopyData(serverCertificate)
                    let data = CFDataGetBytePtr(serverCertificateData);
                    let size = CFDataGetLength(serverCertificateData);
                    let cert1 = NSData(bytes: data, length: size)
                    let file_der = Bundle.main.path(forResource: "name-of-cert-file", ofType: "cer")
                    
                    if let file = file_der {
                        if let cert2 = NSData(contentsOfFile: file) {
                            if cert1.isEqual(to: cert2 as Data) {
                                completionHandler(URLSession.AuthChallengeDisposition.useCredential, URLCredential(trust:serverTrust))
                                return
                            }
                        }
                    }
                }
            }
        }
    }
    
    // Pinning failed
    completionHandler(URLSession.AuthChallengeDisposition.cancelAuthenticationChallenge, nil)
}

This function will “requests credentials from the delegate in response to an authentication request from the remote server.” We will compare the certificate from server with the one that saved in app bundle. If 2 certificates are identical, the authentication will let it pass and client can connect to server.

Types of SSL Pinning(What to Pin)?

Pin the certificate: You can download the server’s certificate and put this in your app bundle. At runtime, the app compares the server’s certificate to the one you’ve embedded.

One disadvantage of SSL pinning is that you have to save the certificate in the app. Whenever the certificate is updated, we need to release new version of app. But this also leads to another problem: what we do with older version?
  • Maintain the old certificate for a time, until we make sure all users have downloaded new version already.

Pin the public key: You can retrieve the certificate’s public key and include it in your code as a string. At runtime, the app compares the certificate’s public key to the one hard-coded hash string in your code.