-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS problem with NativeStorage.keys #106
Comments
@Matt-z91 Hi Matt, I just ran the test suit and key functions test passed on iPhone 7+ with iOS 11.1 cordova-plugin-nativestorage/tests/main.js Line 401 in 3ac059f
If you are sure, then let me explore it further and get back. But, in the meantime could you explain your code/usage and/or try on an iOS <11.1. Thanks! |
Thanks for your reply Alokrajiv. I've managed to partially resolve the problem by changing my implementation. The scenario is as follows:
(At this point, when NativeStorage.keys resolves, I receive a large array full of WebKit values and some NS values -- whether or not I should be seeing this on an iOS device I do not know. On Android I just get the array of keys I want).
My solution for now is just to prefix all random keys with an identifier so I can differentiate between values I want and these WebKit values and such. I'm not currently able to test this solution on iOS 11.1 today but will when I get the chance to. |
@Matt-z91 Another alternative will be save it as a config object and keep updating the object. roughly like Sorry, you have to use a workaround :( |
@GillesC We have a BUG. The test do check if the key exists, but not if there are other entries inside.
showed me :
|
Went till nc2()
|
Thanks for delving into that Alokrajiv, it's much appreciated. |
It seems that iOS is already injecting some keys which can be used to control the WebKit behaviour of an application. And I am, thus, unsure how to resolve this problem. We can live with it. Or we could include our own prefix prior to storing it in nsuserdefaults. But this will make it more complex if users want to access the default injected keys. |
But, how is iOS injecting WebKit. Or is it happening at the Cordova Native Bridge? Here?
|
It could be also Cordova iOS which uses NSUserdefaults to store defaults for the used webview. |
oh..ofcourse. Other components could be using NSUserDefaults. So, that means we need to be careful not to return info not saved by the plugin!! |
The only problem is that we do not want to interfere with the keys used by Cordova or the WebKit (which can also access nsuserdefaults). |
We could do 2 things
|
@alokrajiv |
Stumbled across this issue today. Going to see if I can store all of the keys under one identifier to solve this problem. |
I decided to switch to Ionic's regular Storage, could not get around this bug without substrings and iterating through a giant array. |
Hi folks, I'm by no means an expert and I've only been using Cordova NativeStorage for a couple of days now. I'm having a bit of a problem when calling NativeStorage.keys(s, e)... returning instead a large array (189 items) of various WebKit keys - which I presume to be the NSUserDefaults.
To my knowledge, when debugging my iPhone via Safari I am able to set items to storage just fine, but I am unable to resolve any keys for them.
I am running iOS 11.2 on an iPhone 7plus device.
The text was updated successfully, but these errors were encountered: