apla / me.apla.cordova.app-preferences

App preferences plugin for cordova
Apache License 2.0
201 stars 208 forks source link

Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it. #150

Open Ruchika19021995 opened 3 years ago

Ruchika19021995 commented 3 years ago

Hello,

I am using app grouping (wants to navigate from option of my ios application side menu bar to an ionic application)

IOS Native Application I used this code for app-grouping:

let userDefaults = UserDefaults(suiteName: "group.com.ppp.XYS")

            let loginDictData = Utility.decodedData(key: Defaults[.userID]!) as Data
            let loginDictValue = NSKeyedUnarchiver.unarchiveObject(with: loginDictData)!
            let loginDictCheck = JSON.init(loginDictValue)

            let strUserName = loginDictCheck["username"].stringValue
            let strFirstName = loginDictCheck["firstname"].stringValue
            let strLastName = loginDictCheck["lastname"].stringValue
            let strUserId  = Defaults[.userID]!
            var strRoleName = ""
            if let role = loginDictCheck["userRole"].array{
                let dict = role[0].dictionaryValue
                if let roleName = dict["role"]!["rolename"].string{
                    strRoleName = roleName
                }
            }

            print(Defaults[.jSessionID]!)
            print(Defaults[.jSessionID]! + String.init(format: "; XSRF-TOKEN=%@; ", Defaults[.csrfToken]!) + Defaults[.AWSALBToken]!)
            let xsrfToken = Defaults[.jSessionID]! + String.init(format: "TOKEN=%@; ", Defaults[.csrfToken]!) + Defaults[.AWSALBToken]!
            userDefaults!.set(Defaults[.jSessionID]!, forKey: "JSESSION_Id")
            userDefaults!.set(xsrfToken, forKey: "TOKEN")
            userDefaults!.set(strUserName, forKey: "username")
            userDefaults!.set(strFirstName, forKey: "firstname")
            userDefaults!.set(strLastName, forKey: "lastname")
            userDefaults!.set(strUserId, forKey: "userID")
            userDefaults!.set(strRoleName, forKey: "rolename")
            userDefaults!.synchronize()

            application.open(appURL, options: [:], completionHandler: nil)
        }
        else{
            Toast(text:Utility.sharedInstance.getLanguageConvertedString(string: "ionic  application not found in your device")).show()
        }

then I want to use this plugin with this command on my ionic project:

$ ionic cordova plugin add cordova-plugin-app-preferences $ npm install --save @ionic-native/app-preferences@4

But I am getting this error:

Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.

Ruchika19021995 commented 3 years ago

Please revert me for the same I am in trouble

Ruchika19021995 commented 3 years ago

hello,

have you looked into the issue and have you find any update