Uploaded image for project: 'Realm Cocoa SDK'
  1. Realm Cocoa SDK
  2. RCOCOA-354

Getting multiple users exception when calling SyncUser.current when SyncUser.all.count == 1

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None

      <!---

      Questions: If you have questions about how to use Realm, ask on
      StackOverflow.
      We monitor the realm tag.

      Feature Request: Just fill in the first two sections below.

      Bugs: To help you as fast as possible with an issue please describe your issue
      and the steps you have taken to reproduce it in as many details as possible.

      -->

      Goals

      Want to retrieve the current user after logging all other users out.

      Expected Results

      SyncUser.current returns SyncUser.all.first when SyncUser.all.count == 1.

      Actual Results

      Exception:

      +currentUser cannot be called if more that one valid, logged-in user exists.
      (null)
      
      (lldb) po SyncUser.all.count
      1
      

      Steps to Reproduce

      Could be related to URL change / cached users? I was first logged into my app with SSL disabled. Saw the error only after updating the app with SSL enabled and changing the URLs to use https/realms.

      Version of Realm and Tooling

      <!---
      In the CONTRIBUTING guidelines, you will find a script,
      which will help determining some of these versions.
      -->
      Realm framework version: Swift 3.0.2

      Realm Object Server version: 2.0.23

      Xcode version: 9.2

      iOS/OSX version: iOS 11.2

      Dependency manager + version: Carthage 0.26.2

            Assignee:
            thomas.goyne@mongodb.com Thomas Goyne
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: