apla / me.apla.cordova.app-preferences

App preferences plugin for cordova
Apache License 2.0
201 stars 209 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. #151

Open Ruchika19021995 opened 4 years ago

Ruchika19021995 commented 4 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.