I have created an hybrid app where we upload files using ionic.
For iOS we created a share extension to upload the file and right now trying to pass credentials from ionic application to shared extension in iOS.
I used iOS keychain mechanism as it is supported by ionic native and iOS both.
Share extension I have written in swift and key chain implementation here is using a wrapper like ionic plugin in ionic application.
I am able to save information in ionic plugin and fetch in ionic itself. Similar is the case with shared extension.
although I am not able to get the information which is been shared to shared extension from ionic.
this is what i am using in view controller in shared extension.
let keychainWrapper = KeychainWrapper.init(serviceName: "xxxx.xxx.xxx" )
let str = keychainWrapper.accessGroup
let keyBool = keychainWrapper.accessibilityOfKey("key")
let value = keychainWrapper.string(forKey: "key", withAccessibility:KeychainItemAccessibility.whenPasscodeSetThisDeviceOnly)
let serviceName = keychainWrapper.serviceName
in ionic :
this.keychain.set(key, value,false).then(() => {
this.keychain.get(key)
.then(value => console.log('Got value', value))
.catch(err => console.error('Error getting', err));
})
.catch(err => console.error('Error setting', err));
Is there any other way share information like NSUserdefaults etc which is supported by ionic and iOS swift both?
This tutorial is what I have been following.