800100 Error code when registering device token

// Detailed description of issue.
Getting the below error when trying to register device token on iOS side:

Error Domain=chat Code=800100 “Initialization has not been done yet.” UserInfo={NSLocalizedDescription=Initialization has not been done yet.}

My code is:

    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        // Register a device token to Sendbird server.
        SendbirdChat.registerDevicePushToken(deviceToken, unique: true, completionHandler: { (status, error) in
            if error == nil {
                // A device token is successfully registered.
            else {
                if status == .pending {
                    // A token registration is pending.
                else {
                    // Handle registration failure.

The iOS app could use the send bird UIKit to send and receive messages. So I am thinking it is an ordering issue between the SendbirdChat initialization and registering device token. Could you help suggest how to make the initialization order correct?
Thank you!

// If problem, please fill out the below. If question, please delete.
[UIKit Version]
// What version of the SDK are you using?

[Reproduction Steps]
// Please provide reproduction steps and, if possible, code snippets.

// How frequently is this issue occurring?
Constantly in my local running

[Current impact]
// How is this currently impacting your implementation?
Cannot register device token

Found the solution - Should put initialization in the AppDelegate as well