title: Amplify iOS queries no longer work after signing out and signing in as different user
body: <p>I'm having an issue where my app is working fine until the user signs out and signs in again as a different user. The app will work fine on the first run and I can sign in and queries will work no problem. I can sign in and sign out as the same user over and over again, and the app functions without any issue. The problem lies when I then sign out using and try to sign in as a different user, my app will then just stay on the loading screen indefinitely as queries then cease to work.</p>
  <p>I've tried combinations of <code>Amplify.Datastore.stop</code>, <code>Amplify.Datastore.clear</code>, <code>Amplify.Datastore.start</code> but nothing has worked so far.</p>
  <p>My sign in method calls <code>Amplify.Auth.signOut()</code> beforehand and then signs in the user successfully. Then it sets the root view controller to the main menu where data is fetched using queries:</p>
  <pre><code>Amplify.Auth.signOut() { result in
          switch result {
          case .success:
              print(&quot;Successfully signed out&quot;)
              self.signIn(username: userCredentials.emailAddress, password: userCredentials.password) { (success) in=
                  if (success) {
                      DispatchQueue.main.async {
                          let story = UIStoryboard(name: &quot;Organisations&quot;, bundle: nil)
                          let orgListVC = story.instantiateViewController(withIdentifier: &quot;orgListVC&quot;) as! OrganisationsListTableViewController
                          let nav = UINavigationController(rootViewController: orgListVC)(UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate)?.setRootViewController(nav, .transitionCrossDissolve)
                      }
                  }
                  else {
  
                      DispatchQueue.main.async {
                          let alert = UIAlertController(title: &quot;Sign in Failed&quot;, message: &quot;Sign in failed&quot;, preferredStyle: UIAlertController.Style.alert)
  
                          alert.addAction(UIAlertAction(title: &quot;OK&quot;, style: UIAlertAction.Style.default, handler: nil))
                          self.present(alert, animated: true, completion: nil)
                      }
                  }
              }
          case .failure(let error):
              print(&quot;Sign out failed with error \(error)&quot;)
        
          }
      }
  </code></pre>
  <p>But after this queries no longer work. What could cause this to happen?</p>
  <p>EDIT: I am able to sign in and retrieve data as the next user if I uninstall the app and sign in as them then. But any attempt to sign in as someone else after this will not return query data.</p>