parse-community / Parse-Swift

The Swift SDK for Parse Platform (iOS, macOS, watchOS, tvOS, Linux, Android, Windows)
https://parseplatform.org
MIT License
307 stars 69 forks source link

ParseInstallation not being saved in Keychain #235

Closed lsmilek1 closed 3 years ago

lsmilek1 commented 3 years ago

New Issue Checklist

Issue Description

ParseInstallation.current found not nil only after a fresh install (cleared keychain) and on further app runs found always nil.

Steps to reproduce

0) clear simulator or device keychain 1) run ParseSwift initialisation in didFinishLaunchingWithOptions and print ParseInstallation.current

   func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        ParseSwift.initialize(applicationId: "...",
                              clientKey: "...",
                              serverURL: URL(string: "https://parseapi.back4app.com")!,
                              liveQueryServerURL: URL(string: "https://felse.b4a.io")!,
                              allowCustomObjectId: true)
        print("installation is nil: \(Installation.current == nil)")
        return true
    }

2) restart app without any activity and observe the ParseInstallation.current being nil on second and further launch

Actual Outcome

A currentInstallationContainer: CurrentInstallationContainer<Self> is retrieved from Keychain with set properly installationId but with nil currentInstallation

CurrentInstallationContainer(currentInstallation: nil, installationId: Optional("f4ec6107-8d0b-4718-801b-33e97c64c3ea"))

Expected Outcome

currentInstallation should have been saved during the first run

Environment

Client

Server

Database

Logs

Further description of the issue discussed in issue 171

parse-github-assistant[bot] commented 3 years ago

Thanks for opening this issue!