LocalStorage not working on iOS

  • Problem Description

    ____ I built a game for iOS. I tested it on iPhone 6s, iPhone 7 and iPad Air. The game has few videos that are to be played only one time. In order to make this work I used localstorage to identify whether a video is played for the first time. The first video is playing only one time but the rest are playing every time I launch the app. Not only videos but also all the scores are being whipped out.

    I used the same events for android, there it is working fine. I'm not sure where it went wrong for iOS. The game doesn't contain any third party plugins even. At first I built the game for android after resolving all the bugs I built it for iOS. Everything is fine and smooth on android but I'm facing problems with iOS.

    All the devices are running on 10.2.1 version.

    ____

    Attach a Capx

    ____ https://drive.google.com/file/d/0B9wfZG ... VYZWM/view ____

    Description of Capx

    ____ The Capx consists of a two videos, 20 levels, instruction screens with localstorage assigned to store values for score, stars and check whether video is played for the first time. It consists of basic events, which are same for all the remaining levels (whole project). All the values are retrieved from the localstorage and assigned to global variables on the MainMenuScreen event. All the events work based on the values of global variables.____

    Steps to Reproduce Bug

    • Step 1 - This should be tested on an Apple device (iPad or iPhone).
    • Step 2 - Run the game and try few levels in Green Leafy Planet. All the values will be saved to the localstorage at end of every layout.
    • Step 3 - Once the game is run through few levels, close and reopen the game.
    • Step 4- Once again repeat step 2.

    Observed Result

    ____ Once you run Step 4, the game will starts without the first video then will go to the MainMenu screen and check the stars on left-top of the screen, you will not get any stars that are collected in the previous session. Then go to planets selection screen by clicking play. When click on Green Leafy planet, you will find all the instruction screens appearing just as in the previous session. Then when you select a level, you will find all the instruction screens appearing just as in the previous session.____

    Expected Result

    ____ Once you run Step 4, you should not get any videos or instruction screens appearing. The game should start without the first video then should go to the MainMenu screen and should retrieve stars collected in the previous session. Then go to planets selection screen by clicking play. When you click on Green Leafy planet, you should directly go to the Map screen without any instruction screens. Then when you select a level it should go directly to a level without any instruction screens. ____

    Affected Browsers

    • Chrome: (NO)
    • FireFox: (NO)
    • Internet Explorer: (NO)

    Operating System and Service Pack

    ____ Windows 10 ____

    Construct 2 Version ID

    ____ Construct 2 r239 ____

  • Hi,

    Did anyone get a chance to look into the issue. I'm very close to release the game. I'm just waiting for the iOS build to work. Any update would be appreciated.

    Thanks,

    Sudeep

  • This issue seems to be caused by the WebView + plugin CocoonIO is using.

    If you switch to Canvas+ as webview engine it's working fine.

    Regards

    Andy

  • This issue seems to be caused by the WebView + plugin CocoonIO is using.

    If you switch to Canvas+ as webview engine it's working fine.

    Regards

    Andy

    Hey thanks for the response. I'm using Intel XDK not CocoonIO. Do I need to do anything in Intel XDK?

  • Intel XDK is also using a WebView plugin.

    So maybe it's a basically issue of WebView.

    Regards

    Andy

  • Intel XDK is also using a WebView plugin.

    So maybe it's a basically issue of WebView.

    Regards

    Andy

    Oh okay. I will install that plugin, build the app and reinstall it on a mobile device. I will let you know the output. Thanks.

  • AndreasR

    Hi, I tested the app again. I app already contains Cordova WKWebView Engine. Still the problem exists. Do you suggest me something else?

  • Did anyone get a chance to look into the issue?

    @sudeep98 any solution ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • brandonP No solution so far. Do you face the same issue?

  • sudeep98 not yet I'm studying my options so far construct 2 seems to be solid but for mobile dev not sure...

    But there might be a solution using the system-->save and load as it saves directly on the hard drive. ( if somebody could confirm this approach)

    local and webstorage are considered volatile data by iso10 ... iOS clears cordova localStorage at random

    an other solution would be to use cordova-plugin-nativestorage

    https://github.com/TheCocoaProject/cordova-plugin-nativestorage

  • brandonP Thanks for the information. I didn't know this. As for the suggested plugin, I believe we will need backend plugin for construct 2?

  • It's almost impossible to debug projects like the one you provided. Can you make a minimal .capx as per the bug report guidelines?

    Also does it only happen in cocoon.io's build service? If so you should probably report it to them, since it would probably not be a C2 bug.

  • Ashley Hi, I already provided the .capx and mentioned steps to reproduce the bug in my first post. I use intel XDK build service. The game runs great but the only problem is the game's progress (Local storage) is not saving. This could be a intel XDK error? If yes, I will contact them also.

    Do you want me to add you to my testflight? May be you might understand where and what is the issue.

  • sudeep98 - please see the bug report guidelines. Submitting your entire project is usually unhelpful and makes it far more difficult to resolve bugs. That is why we ask for a minimal project.

  • sudeep98 - please see the bug report guidelines. Submitting your entire project is usually unhelpful and makes it far more difficult to resolve bugs. That is why we ask for a minimal project.

    Okay but the .capx that I shared only consists of around 5% of the whole project. Okay then I will reduce the file size even more and update the shared link. It consists of a video, which has direct link with the local storage.

    I will remove the video and other screens if required, and let you know.

    Thanks.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)