ApplicationStorageDirectory files not loading on iOS

Hi All,
I'm building a game and I have a persistance manager class that manages loading/saving my players game state to the File.applicationStorageDirectory.
I am able to save my player's game to the applicationStorageDirectory, but when I try to load the game state, File.exists always returns false when I run the game on an iOS device. This issue only occurs on iOS - running on a PC is fine.
I've tried compiling with AIR3.4, 3.5 and 3.6 and all of them seem to have the same issue with iOS.
I've inspected the file system of the iOS device, and I can see that saving data to the applicationStorageDirectory is working fine.
Here's a summary of my code:
private var _gameSaveFilePath:String = "gamesave.dat";  
//THIS PART WORKS// 
public function save(serializableObject:ISerializable):void
var nativePath:String = File.applicationStorageDirectory.nativePath.toString();
var file:File = new File(nativePath + "/" + _gameSaveFilePath);
if (file.exists)
file.deleteFile();
var fileStream:FileStream = new FileStream();
fileStream.open(file, FileMode.WRITE);
fileStream.writeObject(serializableObject);
Logger.info(this, "save", "Saved GameState to file: " + file.nativePath);
fileStream.close();
//THIS PART RETURNS AN EMPTY FILE ON iOS, EVEN AFTER A SUCCESSFUL SAVE // 
private function getGameSaveFile():File
return File.applicationStorageDirectory.resolvePath(_gameSaveFilePath);
Can anyone please help with this issue? Why would File.applicationStorageDirectory.resolvePath fail only on iOS, when I know for sure that the file exists on the device?

Hi All,
To cut a long story short, my problem turned out to be due to the Event.Exiting event (which triggered my save method) not being called on iOS, which is a known issue, but I wasn't aware of this.
So my game was barely ever saving - only maybe 1 out of every 10 times, and mostly not at all.
I'm not auto-saving every 30s and everything is working fine.

Similar Messages

  • Xml file not loading from different server

    Hi,
    I have a simple flash banner that is pulling a number from an xml file on a different server. When it gets to the frame where the number should be it just says "transferring data from eckul.com" and will not actually pull in the number. Unfortunately I can't put the files on the same servers. Any help would be much appreciated, below are the links and the xml code I'm using followed by the action script. Cheers
    http://www.sainters.net/newsletters/2010/flash_test_membership2.html
    http://www.eckul.com/number.xml
    <?xml version="1.0"?>
    <inventors>
        <person>
            <name>892</name>
            </inventors>
    function loadXML(loaded) {
    if (loaded) {
    _root.inventor = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
    _root.comments = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
    name_txt.text = _root.inventor;
    comment_txt.text = _root.comments;
    } else {
      trace("file not loaded!");
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("http://www.eckul.com/number.xml");

    so, in frame 1 of your fla before you execute that cross-domain load method, use:
    System.security.loadPolicyFile("http:www.yourcrossdomain.com/subdirectoriesIfNeeded/crossd omain2.xml");
    where the following (crossdomain.xml) is in www.yourcrossdomain.com's root (IF you want to allow allow subdirectory policy files):
    <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
    <cross-domain-policy>
    <site-control permitted-cross-domain-policies="all"/>
    </cross-domain-policy>
    and in the subdirectory (and its descendents) that you want to allow access put crossdomain2.xml:
    <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
    <cross-domain-policy>
      <allow-access-from domain="www.thedomainthatstryingtoloadcrossdomaindata.com" />
    </cross-domain-policy>

  • Troubles with xmp files not loading...

    I'm having troubles with xmp files not loading with images but are present in the image folders. does anyone know why this is happening and if there is a way to fix this. Also when trying to load the xmp individually they are grayed out and unable to load. I have tried this on different machines (Macs) and still no luck. Any help would be greatly appreciated in this issue.

    > The information contained in the XMP file is stored in the DNG file so there is no need for a separate file.
    Aww, yuck!! That's a real drag...
    When editing lots of files (yesterday's shoot produced 8GB) I back everything up to off-line storage and then, after doing all my edits and crops in ACR, I only have to copy over the small XMP files which takes no time at all.
    So if I re-edit the DNG with ACR I have to re-copy ALL the files again to the off-line storage.
    I used to sometimes even save 2 versions of the xmp files when I needed 2 different crops of the same images, such as doing a wide screen 'cinema' crop for a corporate client's Intranet presentation of their event, as well as more standard crops to be used for their newsletters.
    Guess I won't be using DNG any more..
    Thanks for the help Kees :-)
    Russell

  • ITunes store not loading with iOS 7 on iPhone 4S

    iTunes store not loading with iOS 7 on iPhone 4S.
    I have tried reset network connections
    I have restored
    I have backuped
    I have erased all content
    I have rebooted
    I have DFUed.
    I have also the same issue with iTunes on pc, with -50 error.
    Is this an apple server error?!

    Thom_d, you mean your 4s work smoothly? my 4s also 32gb look to be more laggy especially playing asphalt8, infinity blade2, etc... the graphic will stop for few second while you racing.. Are you sure you didn't encounter this kind of problem? About battery life, it only last for 5hours without 3g services(only using wifi). Pretty shock saw what you mention above.

  • Imported Jar file not loaded at run time ORA-105100

    Oracle 9iDS forms Version 9.0.2.9.0
    Oracle 9iAS Release 2
    I have imported java classes from a jar file into my form. I have it working in client server. Added the entries to the classpath in the default.env and system environment variable for development of the form and for execution.
    Moved the jar file, form and testing html to the application server. Modified the classpath in the default.env file. Tested the form. Got the ORA-105100 error. MetaLink note 261650.1 states that error frm-40735 When-Button-Pressed triger raised exception ORA-105100 if calling a java function from a jar file. Cause: Jar file not loaded at run time. Solution: add in your default.env CLASSPATH parameter your jar file including the whole directory of the jar file location. That has been done and the OC4J has been restarted. Still get error.
    Oracle support has not been able to give me much help as of yet. Does anyone have any further ideas, or documentation that I can read to help get this working?
    Thanks in advance for any assistance that is offered.

    Hey people any clues?

  • Dreamweaver widget spry .js files not loading

    Problem with spry .js files not loading on index.html whats wierd is it works on other servers but not on other one, is there any js restrictions on the server, links the same, Is it;
    1. useing site root to lnk .js? buggered if I know! But really need to fix this, and all other widgets I have on the site are fine.
    2. Some one suggested there should also be a SpryWidgetBase ? whats that about?
    3.Is my DOCTYPE  ok?
    As I said here it is fine http://www.tompriceshs.wa.edu.au/Publish/ and its the exact same copy! as http://www.tompriceshs.com.au/ but not working here as you will see.
    Your greatness is required yet again! Please.
    Skip

    These are the first lines of the working SpryWidget.js
    // SpryWidget.js - version 0.16 - Spry Pre-Release 1.7
    // Copyright (c) 2009. Adobe Systems Incorporated.
    // All rights reserved.
    // Redistribution and use in source and binary forms, with or without
    // modification, are permitted provided that the following conditions are met:
    //   * Redistributions of source code must retain the above copyright notice,
    //     this list of conditions and the following disclaimer.
    //   * Redistributions in binary form must reproduce the above copyright notice,
    //     this list of conditions and the following disclaimer in the documentation
    //     and/or other materials provided with the distribution.
    //   * Neither the name of Adobe Systems Incorporated nor the names of its
    //     contributors may be used to endorse or promote products derived from this
    //     software without specific prior written permission.
    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
    // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    // POSSIBILITY OF SUCH DAMAGE.
    (function() { // BeginSpryComponent
    and this is the same for the not working JS
    / SpryWidget.js - version 0.16 - Spry Pre-Release 1.7//// Copyright (c) 2009. Adobe Systems Incorporated.// All rights reserved.//// Redistribution and use in source and binary forms, with or without// modification, are permitted provided that the following conditions are met:////   * Redistributions of source code must retain the above copyright notice,//     this list of conditions and the following disclaimer.//   * Redistributions in binary form must reproduce the above copyright notice,//     this list of conditions and the following disclaimer in the documentation//     and/or other materials provided with the distribution.//   * Neither the name of Adobe Systems Incorporated nor the names of its//     contributors may be used to endorse or promote products derived from this//     software without specific prior written permission.//// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE// POSSIBILITY OF SUCH DAMAGE.(function() { // BeginSpryComponent     if (typeof Spry == "undefined" ||
    My guess is that the latter has been cottupgwd on the way up. Sorry, corrupted.
    To prove the theory, simply link SpryWidget.js from ..wa.edu.au to ..com.au as in
    <script type='text/javascript' src='http://www.tompricehs.wa.edu.au/Publish/Spry-UI-1.7/includes/SpryWidget.js'></script>
    Gramps

  • 4917 license file not loaded

    Hi for all ,
         I have problem with call manager version 6.1 , we upgrade from 4.x to 6.x  , after that when i access
    there massege ( warning license .......)  and when i try to add or delete phone i recevied this massege add phone  ( add failed .[4917 ] license file
    not loaded ) ,  delete phone ( error occured one or more record did not get delete. [4917] license file not loaded ) .
        Please can you help me to solve this problem and how i can solve .
    Thanks ,

    https://supportforums.cisco.com/thread/296808
    i got this link its worth reading or not???

  • Oracle lite message file not loaded

    Hi..
    I'm not getting the proper error messages listed for the POI - error messages. It throws out "message file not loaded". do I have to run/update any scripts manually. please throw me some light

    Hmmm...
    is Your olite40.msb file missing somehow?
    You need it since all error messages for the POL Error Numbers can be found in there.
    I think it has to be in Your PATH.

  • Website's browser fill does not load on iOS devices.

    I've checked this on several different iPads &amp; iPhones with similar results. Works and loads correctly on android devices and different desktop web browsers.

    So the background fill is the issue not the welcome page. Here is a screenshot of how it should look like on my iMac; It is an image I've used as the background fill for the entire site. It's been used within the A MAster. However, on iOS devices as you can see from your own screenshot, the background does not load and is gray. 
    Also on "The Shop" page there is nothing off to the left side other than a compostion widget I've used with scroll effects to achieve a 100% pagewidth slideshow. HEre is a screen shot of the the entire page with everything selected. I am willing to provide you with my .muse file so you can investigate more/
    Thanks!

  • XML file not loading in FF from server

    I've created a web page that loads an external XML file and
    then uses javascript code to parse the file for requested
    information. I know it's not the best way to do this, but I'm
    trying to get this working before I move on to "better" methods.
    When I run the page using the "Preview/Debug in browser"
    funtionality of DW everything works great both in IE and FF. But
    when I load the page to the server and then load the page in a
    browser, it works in IE but not in FF. It looks as though FF is
    just not loading the XML file. I can't figure out why the page
    would work if launched from DW, but not work if the page is loaded
    on the server and then run from there, and only in FF.
    The code I'm using to load the XML file is supposed to be
    cross-browser compatible. I've seen many versions like from various
    sources, so it should be OK. I'm pretty new to all of this so I'm
    hoping that I'm just missing something simple. Does anyone have any
    idea why this is behaving this way?
    Thanks for any help.

    so, in frame 1 of your fla before you execute that cross-domain load method, use:
    System.security.loadPolicyFile("http:www.yourcrossdomain.com/subdirectoriesIfNeeded/crossd omain2.xml");
    where the following (crossdomain.xml) is in www.yourcrossdomain.com's root (IF you want to allow allow subdirectory policy files):
    <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
    <cross-domain-policy>
    <site-control permitted-cross-domain-policies="all"/>
    </cross-domain-policy>
    and in the subdirectory (and its descendents) that you want to allow access put crossdomain2.xml:
    <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
    <cross-domain-policy>
      <allow-access-from domain="www.thedomainthatstryingtoloadcrossdomaindata.com" />
    </cross-domain-policy>

  • Flash file not loading first time but loads on refresh

    I have a problem where a flash program is not loading when
    the webpage is first visited, it will get stuck on the loading
    screen. Now for this file to finish loading, it needs to load in
    another file. Once that file is done loading then the program will
    continue. But like I said the first time the program gets stuck on
    the loading screen and never continues. If you hit refresh in the
    browser then the program will continue past the loading screen.
    I've checked the code and everything seems fine there. Could
    this be a security issue? The two files are on the same domain. Or
    if anyone has any insight into this problem, it would be
    appreciated.

    "Dusarn" <[email protected]> wrote in
    message news:e3b9i7$qup$[email protected]..
    >I have a problem where a flash program is not loading
    when the webpage is first
    > visited, it will get stuck on the loading screen. Now
    for this file to finish
    > loading, it needs to load in another file. Once that
    file is done loading then
    > the program will continue. But like I said the first
    time the program gets
    > stuck on the loading screen and never continues. If you
    hit refresh in the
    > browser then the program will continue past the loading
    screen.
    >
    > I've checked the code and everything seems fine there.
    Could this be a
    > security issue? The two files are on the same domain. Or
    if anyone has any
    > insight into this problem, it would be appreciated.
    That is almost always caused by a faulty preloader code. Post
    your preloader code or a link to the website so it can be checked.
    tralfaz

  • SWF Files Not Loading

    I created a master fla and swf files to load into the master
    file externally. Everything loads into the master file just fine
    when I view it in flash or flash player. However I need to add a
    background to it along with a couple other things that I only now
    how to do in dreamweaver. Dreamweaver will load the master flash
    swf but it wont load the external swfs. Please help if you can.
    Thanks.

    I am not sure I completely understand what you are trying to
    do. Can you give us a link to the page in question?

  • Swf file not loading over Https(SSL) on Internet Explorer...

    hi ,
    I have a .swf file used in html file and i try to browse using "https(SSL)".it will loads fine in Firefox, but in Internet Explorer wont able to load. When right-clicking it says "movie not loaded".
    even i googling for the same and i got below option but i am still not able to get flash on html page. it will working fine in Internet Explorer,FireFox etc when we use"http".
    1) add headers like "Cache-Control: must-revalidate" or "Cache-Control: max-age=0" or "Cache-Control: no-store" etc
    2) use CrossDomain.xml
    we also able to load swf in https on Internet Explorer but for that we have to do below settings in Internet Explorer browser.
    1) Go to Tools --> Click on Internet Option --> click on Advanced tab --> Now in security section checked mark on "Do not save encrypted pages to disk".
    but above way is not a proper way to resolve the https issue
    Thanks.

    found this within the Adobe forums, seems to solve your issue.
    I would make sure to use the crossdomain file as well.

  • SWF files not loading onto page in Catalyst output.

    Hello,
    This is a new one that I have not yet seen.  I have a large assortment of SWF files set up in Scroll Panes and they are not loading up when I check the project using Firefox or Safari.  The site is here:
    www.electronic-lifestyle.com
    Go into any page linked from the top row and then hit a sub page.  When you see a scroll bar come up on the right side of the film strip yet nothing inside the film strip you will see the issue.
    This is really serious and could screw up my entire project so any advice would be really helpful.  I need to figure out why the SWF files are not loading in on the browser with the files from the server when they work just fine using the local deploy files.  Everything works just fine from the machine but when I try to get it to download from the server nothing.
    All of the SWF files are built in Flash CS5 using AS3 and contain some simple links and commands.  Some of the SWF files are coming up just fine, it is just the latest batch of files I have uploaded that are giving me the problem, but only off the server.  The same files work just fine in local mode.
    Thanks in advance,
    Brett

    Chris,
    This is not an apples to apples comparison but I think it will Illustrate the differences.  This is a sample of code from Catalyst that works:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Group xmlns:s="library://ns.adobe.com/flex/spark" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:fclib="com.adobe.flashcatalyst.components.*" xmlns:d="http://ns.adobe.com/fxg/2008/dt">
        <fx:Script>
            <![CDATA[
                protected function mac_btn_clickHandler():void
                    navigateToURL( new URLRequest( encodeURI("http://www.mcintoshlabs.com")), "_blank");
                protected function integra_btn_clickHandler():void
                    navigateToURL( new URLRequest( encodeURI("http://www.integrahometheaters.com")), "_blank");
            ]]>
        </fx:Script>
        <fclib:SWFController loadForCompatibility="true" source="assets/images/ElectronicMain2c.swf" x="0"/>
        <s:Button skinClass="components.Button1" x="0" y="1328" d:userLabel="Mac_btn" click="mac_btn_clickHandler()"/>
        <s:Button skinClass="components.Button1" label="Button" x="0" y="1768" d:userLabel="Integra_btn" click="integra_btn_clickHandler()"/>
    </s:Group>
    This is an example of the AS3 code that was confounding the SWF load on the example I gave:
    button_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage);
    function fl_ClickToGoToWebPage(event:MouseEvent):void
        navigateToURL(new URLRequest("http://www.mcintoshlabs.com"), "_blank");
    button_2.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage_2);
    function fl_ClickToGoToWebPage_2(event:MouseEvent):void
        navigateToURL(new URLRequest("http://www.integrahometheater.com/"), "_blank");
    Now these are from the same page, the first of which is online right now here:
    www.electronic-lifestyle.com/AS/Main.html
    This particular code is used on the Electronics page.  When I look at the two side by side it seems there are some syntax differences but I do not know enough about AS3 to tell what the important differences are.
    Thanks for looking,
    Brett

  • Web pages do not load after ios 6

    My iPod touch received the IOS 6 update Thursday night and since then I can not load any web sites in Safari!  It will sit there spinning for a while and then I get a message "Safari could not open the page because the server stopped responding."  I have gotten this same behavior when connected to my own network at home as well as the network at work. The network connection itself looks ok based on the signal strength bars. 
    Any suggestions on what's worng?
    Is there any way to revert to the previous IOS version?

    - Reset the iPod. Nothing will be lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Power off and then back on the router.
    - Reset networks settings: Settings>General>Reset>Reset Network Settings

Maybe you are looking for

  • HT204266 i have two itunes accounts... can i combine them?

    The question says it all...

  • Oracle 10g FRM-41051 on a non-database text item with a LOV

    Hi all, I'm struggling with a problem I'm convinced must have a really simple solution, but for the life of me I can't figure it out! I have a data block called query. It is a non-DB block with a number of items, with either LOVs or drop down lists.

  • How to add attachment to a BO?

    Hello Colleagues, I am trying to use the dependent object AttachmentFolder to be able to upload document to the BO: [DependentObject(AttachmentFolder)] node Attachement; Then in UI Designer, the node Attachement is bonded to reuse component /SAP_BYD_

  • Write Off Quantity and value

    hi, How do I write off the value and quantity for the stocks? For stock materials we do the physical inventory - entering count adjust qty and posting adjust vale . But how can I adjust for value only articles?

  • Photoshop elements 12 and shared technologies

    I'm trying to install Photoshop Elements 12 on windows 7 and I'm getting an error message: fail to install shared technologies. Can some one help?