Skip to content
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

callbacks don't seem to work on iOS 10 beta 7 #36

Closed
cwelk opened this issue Aug 26, 2016 · 19 comments
Closed

callbacks don't seem to work on iOS 10 beta 7 #36

cwelk opened this issue Aug 26, 2016 · 19 comments
Assignees
Labels

Comments

@cwelk
Copy link

cwelk commented Aug 26, 2016

First I wanted to thank you for the awesome plugin 😄

On iOS 10 (beta 7) the global NativeStorage Object is accessible, along with all documented methods. Unfortunately none of the callbacks get executed.

This example code works in iOS 9 but gives no output whatsoever (web Inspector, xcode console) in iOS 10:

NativeStorage.setItem('sample', 'abc', function () {console.log(arguments)}, function () {console.log(arguments)})

I know it's still beta but do you plan on adding iOS 10 support?

@GillesC
Copy link
Collaborator

GillesC commented Aug 26, 2016

After my vacation, I will look into the matter. But be reassured that Android and iOS support is a priority for us. So, we will definitely plan on adding iOS 10 support. I will leave this issue open until the support is added.

@alokrajiv alokrajiv added the bug label Aug 26, 2016
@kristfal
Copy link

kristfal commented Aug 31, 2016

@GillesC Confirming this. It seems like the plugin does not initialize on iOS10 Beta 8. This plugin is likely to increase in popularity on iOS10, as tests so far reveal that LocalStorage in a WkWebview no longer persists between app launches.

Also, this plugin fails to compile on Cordova iOS < 4.0.0 due to int conversion.

@GillesC
Copy link
Collaborator

GillesC commented Aug 31, 2016

Thanks for the conformation. For compiling with Cordova ios < 4 see issue #29.

@GillesC GillesC self-assigned this Aug 31, 2016
@kristfal
Copy link

@GillesC Cheers, thanks for the tip – I was about to do that same Int conversion myself. Not to pressure you, but do you have any idea when you'll start looking at iOS 10 support?

I'm currently torn between waiting on you to fix this (which is preferable), or going for an alternative option such as webSQL (which is rather overkill for our needs) to make sure we can support iOS10 when it launches.

@GillesC
Copy link
Collaborator

GillesC commented Aug 31, 2016

I'm currently on a holiday. But tomorrow I can take a look why the plugin isn't working in iOS 10. So by the end of this week the plugin should certainly work. When is iOS 10 be going officially released?

@kristfal
Copy link

@GillesC Thanks a lot! I'll wait for you then 👍

The new iPhones will be announced on the 7th, and looking at how Apple handled this before, iOS10 GM is likely to be released for developers right before that date, with a public launch some time within a week after the 7th.

@GillesC
Copy link
Collaborator

GillesC commented Aug 31, 2016

In iOS the console plugin is needed to use the console (https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-console/). Could you include this plugin in your project and put the output here?

@kristfal
Copy link

kristfal commented Sep 1, 2016

@GillesC Not quite sure I am following. The iOS console is working without the plugin. Also, this doesn't work either, so this doesn't seem like an issue with the console:

NativeStorage.setItem('sample', 'abc', function () {alert(arguments)}, function () {alert(arguments)})

@GillesC
Copy link
Collaborator

GillesC commented Sep 1, 2016

This example code works in iOS 9 but gives no output whatsoever (web Inspector, xcode console) in iOS 10

I thought maybe the "no output" was because the console plugin wasn't installed, and therefore no output was printed.

@kristfal
Copy link

kristfal commented Sep 1, 2016

@GillesC Ok, glad we sorted that out 👍 Let me know if you need any other information!

@GillesC
Copy link
Collaborator

GillesC commented Sep 1, 2016

@kristfal before I dive in this mess, would you please try the solution presented in this thread? If it works I don't need to go to the hashle of installing iOS 10 etc. :)

@kristfal
Copy link

kristfal commented Sep 1, 2016

@GillesC That actually fixed it!

@GillesC
Copy link
Collaborator

GillesC commented Sep 1, 2016

Haha that's just great!! :D Closing the issue now and adding this issue and solution to the "Problems" section.

@GillesC GillesC closed this as completed Sep 1, 2016
@kristfal
Copy link

kristfal commented Sep 1, 2016

@GillesC Confirming that it is working as expected on iOS10. I must say, this plugin is now a godsend because iOS10 wipes LocalStorage on app exit. Thanks a lot for making it 👍

@alokrajiv
Copy link
Collaborator

alokrajiv commented Sep 1, 2016

I think all tests are passing on the simulator beta.

@alokrajiv
Copy link
Collaborator

@kristfal wud it be possible for you to list what exactly you did so, I cud include it in the faq for others?

@kristfal
Copy link

kristfal commented Sep 5, 2016

@alokrajiv:

In your index.html that you are loading on app startup, add the following entries to your Content-Security-Policy meta tag:

gap://ready file:

An example of a 'liberal' CSP which should enable pretty much all content (not really recommended) is:

<meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-inline' 'unsafe-eval' 'self' gap://ready file: ws://<url to ws endpoint> cdvfile:; child-src * 'unsafe-inline' 'unsafe-eval' blob:; img-src * 'self' data: blob:;" />

Remove what you don't need, and specify <url to ws endpoint> if you use websockets.

@jcleyba
Copy link

jcleyba commented Oct 19, 2016

Will this work for Ionic 2? Adding this to index.html does not fix the issue.

@dodomui
Copy link

dodomui commented Mar 13, 2019

I'm still facing the issue for ionic v1, any one got idea what to do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants