IOS 8 - FileStream throwing error 2038 on open for write?

Hey all,
Going through iOS 8 compatibility checks with our Adobe AIR app (tested with AIR 13 and AIR 14), I'm noticing changes to file storage.
In short, my code has always been as follows for simply storing a player profile file (matching iOS documentation for as fas as I know: File System Programming Guide: File System Basics). And this has worked well to prevent purges when the device is low on storage space as well as keeping the data there when updating the app.
This code only seems to work for iOS 4 to iOS 7:
var storagePath:File = new File(File.applicationDirectory.nativePath + "/\.\./Documents");
try
     var targetFile:File = storagePath.resolvePath("profile.bin");
     var stream:FileStream = new FileStream();
     stream.open(targetFile, FileMode.WRITE);
     stream.writeBytes(<byteArray here>, 0, 0);
     stream.close();
catch (err:Error)
     <informs user something went wrong, retries, etc. basic error handling>
Running this on iOS 8 will always throw a SecurityError (#2038) from stream.open.
Now, we can still save data and fix this by replacing the first line by:
var storagePath:File = new File(File.applicationStorageDirectory.nativePath);
But, this leaves me with a few things, in order of descending importance:
1) Reading something like this makes me scared as our game has a large amount of daily players: "I’m using applicationStorageDirectory to store files. The problem is those files get deleted when the user updates his app…" (AIR App Compliance with Apple Data Storage Guidelines, last comment)
2) What has changed in the iOS 8 file system that suddenly makes my original code fail? Apple developer documentation is still outlining this should be valid. Is this a possible AIR bug?
3) I assume I need to set "don't backup" flags on the files when saving to the appStorageDir?
4) Is anyone else running into this?
Thanks in advance!

Thanks for your quick reply!
I agree about not traversing up the directory tree, but a blog post from an Adobe employee I read a long time ago put me on that track: Saumitra Bhave: AIR iOS- Solving [Apps must follow the iOS Data Storage Guidelines]
Anyway, I ran some tests including your suggested solution and it returns an interesting result:
#1 File.documentsDirectory (iOS 8)
Full path = /var/mobile/Containers/Data/Application/<UUID>/Documents
Result: works as expected, no errors thrown!
#2 new File(File.applicationDirectory.nativePath + "/\.\./Documents")  (iOS 8)
Full path = /private/var/mobile/Containers/Bundle/Application/<UUID>/Documents
Result: error, no write permission! (as I would expect with 'private' being there)
#3 File.documentsDirectory (iOS 7)
Full path = /var/mobile/Applications/<UUID>/Documents
Result: works as expected!
#4 new File(File.applicationDirectory.nativePath + "/\.\./Documents")  (iOS 7)
Full path = /var/mobile/Applications/<UUID>/Documents
Result: works as expected! (notice it's exactly the same as #3)
So, while the storage directory is easily adjustable and #1 should fit the bill nicely, I'm thinking of how to preserve user data when people begin updating from iOS 7 to iOS 8 as it will be kind of hard for me to locate my earlier data on iOS8 unless part of the update process is to also relocate all application data? I mean, even if I had used File.documentsDirectory before, this would still be a potential problem? In any case, it's obvious the iOS8 file system is different.
How is this going to work?

Similar Messages

  • Archive file cannot be opened for write program

    Hi All,
    I am getting the error message "annot be opened for write program" in log view, when I am trying to write data into archive file using "write' function.
    Please provide us the solution for this problem.

    Hello,
    It must be due to missing authorization for the write operation.
    Please inform the security consultant along with SU53 details.
    Regards
    Vijay Gajavalli

  • Error trapping with OPEN FOR

    I am trying to add some error handling to this packaged procedure written by someone else.
    How can I check for an Oracle error in the query in m_sql_string? I have tried checking
    SQLCODE after the 'OPEN FOR', but it is always 0 even when errors are being encountered.
    I need to trap errors and write them to an error table.
    CREATE OR REPLACE PACKAGE P1
    AS
    TYPE CHCUR IS REF CURSOR;
    PROCEDURE QRY_WR_STATUS_CHANGES (tsAfter IN VARCHAR2, rsResult OUT CHCUR);
    END P1;
    CREATE OR REPLACE PACKAGE BODY P1
    AS
    PROCEDURE QRY_WR_STATUS_CHANGES(tsAfter IN VARCHAR2, rsResult OUT CHCUR)
    IS
    m_sql_string VARCHAR2(30000);
    BEGIN
    m_sql_string := 'SELECT TS_STATUS, CD_STATUS, CD_WR, RowId
    FROM TABLE_A
    WHERE
    NOT EXISTS (SELECT ''X'' FROM TABLE_B where TABLE_B.USER_NAME =TABLE_A.ID_OPER)
    ) AND
    NOT EXISTS (SELECT ''X'' FROM TABLE_C where TABLE_C.wr = TABLE_A.CD_WR and
    TABLE_C.dist = TABLE_A.CD_DIST)
    AND
    TABLE_A.TS_STATUS >
    TO_DATE('''||tsAfter||''', '||'''MM/DD/YYYY HH24:MI:SS'')
    AND CD_STATUS Like ''%X''';
    OPEN rsResult FOR m_sql_string;
    END QRY_WR_STATUS_CHANGES;
    END P1;
    Thanks in advance.

    Thank you. I just tried adding such an exception block. It compiles and runs fine, but isn't trapping the error. I see the error returned in the results when I call the proc from SQL*PLUS, but can't seem to trap it in the code...it's like I need to check the contents of the OUT data for the error or something. Below is the modified code and then showing executing it and the results. Any further ideas are greatly appreciated.
    CREATE OR REPLACE PACKAGE P1
    AS
    TYPE CHCUR IS REF CURSOR;
    PROCEDURE QRY_WR_STATUS_CHANGES (tsAfter IN VARCHAR2, rsResult OUT CHCUR);
    END P1;
    CREATE OR REPLACE PACKAGE BODY P1
    AS
    PROCEDURE QRY_WR_STATUS_CHANGES(tsAfter IN VARCHAR2, rsResult OUT CHCUR)
    IS
    m_sql_string VARCHAR2(30000);
    BEGIN
    m_sql_string := 'SELECT TS_STATUS, CD_STATUS, CD_WR, RowId
    FROM TABLE_A
    WHERE
    NOT EXISTS (SELECT ''X'' FROM TABLE_B where TABLE_B.USER_NAME =TABLE_A.ID_OPER)
    ) AND
    NOT EXISTS (SELECT ''X'' FROM TABLE_C where TABLE_C.wr = TABLE_A.CD_WR and
    TABLE_C.dist = TABLE_A.CD_DIST)
    AND
    TABLE_A.TS_STATUS >
    TO_DATE('''||tsAfter||''', '||'''MM/DD/YYYY HH24:MI:SS'')
    AND CD_STATUS Like ''%X''';
    OPEN rsResult FOR m_sql_string;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('Error code is: Long postings are being truncated to ~1 kB at this time.

  • GPO Restrict All Drives policy throwing error when saving/opening in Office 2013

    We're running Windows 8.1 x86 and have a GPO that, among other things, restricts access to all drives.
    In all Office applications, when a user clicks File > Save As > Computer > Browse (or any recent folders like 'Desktop', 'Documents' etc.) it throws an error:  "This operation has been cancelled due to restrictions in effect on this computer.
    Please contact your system administrator." When the user clicks 'OK', they are able to save to the Desktop or Documents folder without further error.
    When this policy setting is disabled, this error no longer appears. 
    So the policy isn't actually causing problems with functionality, it just causes an error which is confusing and annoying to the users. 
    Has anyone experienced this before? Or can anyone point me in the right direction for a resolution?
    Thanks in advance!!

    "But this policy does not prevent users from using programs to access local and network drives, in
    your case, use Office to access the drives."
    I am using Office to access the drives, Kapaal. The only place that we allow users to save documents is the desktop and this functionality works - it just throws an
    error every time you try to save.
    I'll post in the Group Policy forum and see if I can get an answer.
    Thanks!

  • Count() function throws error in EQL query for metric

    Hi
    I am trying to use count function in EQL query for Metric Bar to show the number of occurrences of a record.
    When the record type doesn't exist i expect the function to return count as 0. Instead the function throws a runtime exception and the whole Metric Bar portlet fails, with error No Results Available. Even though other components in the metric bar have valid results.
    2013-02-21 13:03:51,216 WARN [MetricsBarQueryProcessor] The EQL query does not return any results.
    2013-02-21 13:03:51,216 ERROR [MetricsBarQueryProcessor] The EQL query does not return any results.
    2013-02-21 13:03:51,216 WARN [MetricsBarResultsProcessor] No statement results to process.
    The EQL query i am using is
    RETURN NUMBER_OCCURS AS SELECT COUNT(EMP_ID) AS NUMBER_OCCURS where EMP_NAME IS NOT NULL group;
    I tried using COALESCE but that doesn't help.
    Can some one please suggest a workaround to this?

    Srikanth,
    Two statements are used here because the original question was pertaining to the null set (where there are employees in the nav state but no employees that fit the special analytics criteria in the navigation state). The question/answer has nothing to do with what is in the COUNT parentheses clause as Counting a null set will always give you NULL, not 0, no matter what you put in there.
    What we're really doing, in the second part of the query, is writing a query over a set of data that is not the null set (i.e. the current navigation state). This allows the 0 value to come through in the case where the first analytics statement is evaluated over a null set of records. If there were truly no records in the navigation state, this too would return a null set and not zero.
    Hope that makes sense, feel free to respond (either on here or offline) if it's unclear.
    Regards,
    Patrick Rafferty
    http://branchbird.com

  • Portal 7.02 SP6 on Google Chrome throws error.

    Portal 7.02 SP6 on Google Chrome throws error:
    Could not open iView. The iView is not compatible with your browser, operating system, or device. Contact your system administrator for more information.
    Is there a fix for this issue. Please advise. Thanks.

    To (freely) quote an SAP executive that I asked about browser support:
    "what kind of browsers should SAP support? It does not make sense to support non-enterprise ready browsers".
    I interpret that as: when you spent some serious $$$ for the SAP Portal you should get your infrastructure in line with the corporates ERP vendor strategy == buy Microsoft, use IE 6, 7 or 8
    At least FF support is speeding up, even when it's impossible for SAP to keep up with the release cycles of Mozilla (when SAP releases a SPS Mozilla already released 2 new FF versions).
    This sorts out effectively Google and Opera (what is Statoil using?) and a bunch of mobile browers (all). Why Safari is considered more enterprise ready than Chrome? My 2ct: Apple is an SAP customer and they paid for getting support.
    Guess we'll have to wait for Google start using SAP and the Portal.
    br,
    Tobias

  • What does the error - file open with write privilege mean?

    When exporting an iMovie, I received the error message, file open with write privilege - what does that mean and what causes it?

    Hi
    Error -49
    Error -49  opWrErr  File already open with write permission
    Trash the preference files while application is NOT Running.
    Yours Bengt W

  • SharePoint Error "The security validation for this page is invalid" when delete an item

    Hi,
    I have SharePoint 2010 setup and works fine until today all of a sudden it throws error "The security validation for this page is invalid" when delete a SharePoint document or list item.
    There is no custom event handler deployed on library/list, and it should not be account issue as the same account works yesterday, and even after I turn off security validation from Central Admin, it still doesn't work.
    The only change I did is turn off Dynamic Compression from IIS, after that I tried enable back Dynamic Compression but it still doesn't work.
    Does anyone know what could be the possible reasons? Thanks in advance.

    hi,
     in the page just try to make this :
    <SharePoint:FormDigest runat="server" />
    PrasadWT

  • I am using report generation toolkit 1.1 with Labview 7.0 and Office 2003 profession​al. The create new report VI opens Excel but throws error (-21471672​62- from automation open VI) when I try to open MS word. please help...

    I am using report generation toolkit 1.1 with Labview 7.0 and Office 2003 professional. The create new report VI opens Excel but throws error (-2147167262- from automation open VI) when I try to open MS word. please help...

    Hi Leo22,
    Does this error occur if you use any of the example programs that come shipped with LabVIEW? I would try opening one of the examples that write data to Word and see if those give you an error. Also, have you tried just putting down a New Report.VI and change the report type to Word? If this simple vi (that's all you need to open Word) breaks, I would check to see if there are any instances of Word still open. Check the task manager to see if any word processes are still open. There should not be a problem accessing Word 2003 from LabVIEW 7.0. If neither of these solutions work, please give some more detail about your application and we can research further. Thanks!
    Jeremy L.
    National Instruments
    Jeremy L.
    National Instruments

  • Libre ~ Error 2038 "failed to open the file"

    Good morning.
    I have a Libre-eBook reader Pro.
    I have downloaded and synced from Kobo to my Libre with no problems.
    But when I try to download ebooks from the public library they download and open in Digital Editions just fine.  I drag and drop them into the bookshelf marked Libre-eBook Reader Pro.
    They show up when I turn on my ebook, but when I try to open them I get the 'failed to open the file'.
    I was also getting the Error 2038 in Digital Editions when I did the drag and drop thing.  I read through the forum and went through the steps recommended for the Nook ~ deleting the digital editions folder on my ebook and having Adobe reauthorize it.  I no longer get the 2038 error message in Adobe, but I am still unable to open the books from the library.
    I have tried deleting the books from ereader and ADE and redownloading from the Library.  Didn't help.
    Any other suggestions?
    Thanks.
    Heather

    Hi Ambs101010,
    Based on my research, the error can be caused by that the machine.config file is incorrect or corrupted. Please use the following steps to troubleshoot the issue and check if the error still occurs.
    1. Open the machine.config in Visual Studio and check if there is any syntax errors. If syntax errors exist, modify the machine.config file directly. For more details, please review this similar
    thread.
    2. If the error still persists, please follow the steps to replace the machine.config file. Another alternative method is to replace the current machine.config with the machine.config file from another computer.
          a.  Go to the folder C:\windows\Microsoft.NET\Framework\v2.0.50727\CONFIG
          b.  Rename the file machine.config to machine.config.old
          c.  Make a copy of the file machine.config.default and rename the copy to be machine.config
          d.  If your Operating System is 64-bit, go to the folder C:\windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG and repeat the above steps
          e.  Reboot your computer
    Thanks,
    Lydia Zhang

  • SharePoint Designer: throwing error while open my sharepoint web applicaiton

    When i try to open web application in sharepoint designer. I can't able to open it throw error like this
    An Error occured accessing your Microsoft sharepoint foundation site files. Authors - if authoring against a web server, please contact the webmaster for this server's web site. WebMaster - please see the server's application event log for more details

    This error occurs if you try to use a reverse proxy to rewrite the response body contents for a SharePoint site as well. We were attempting to inject a Google analytics tracking javascript in the body of all responses. The code never did show up
    successfully and this error message resulted as well. We eventually discovered a web solution out on Codeplex that allows you to add the Google analytics tracking script. This article hinted at the root cause:
    http://support.microsoft.com/kb/329362/en-us

  • Report opens in "Design" mode and throws error

    Hi All,
    One of my user gets an attached error when he opens a report. I noticed that, this happens because his report always open in "Design" mode. Now when we click on "Reading" mode, it works fine.
    Also, this behavior is happening only for one report. What can be the issue ? Is there a way in settings that I can do, so that the report always opens in "Reading" mode.
    BI4.1 SP1
    Thanks,
    Anupam,

    Check this KB:
                  2016483  - error: "while trying to
    invoke the method java.util.List.iterator() of null object loaded from
    local variable 'nodes' (Error: INF)”

  • I am getting a 42404 error message when opening itunes and itunes will not let me connect my iphone to it trying to get me to restore. I need help?

    I am getting a 42404 error message when opening itunes and itunes will not let me connect my iphone to it trying to get me to restore. I need help? I am not that technically inclined and really simple terms  are appreciated.

    Try downloading the songs from a different device. If you are doing it from your iOS device, try form your computer.

  • Web Analysis 9.3.1: Error occured while opening document. Document ID = {0}

    Hi Experts,
    I am having an issue while opening a web analysis dashboard report. When I try opening it, web analysis runs for about 15 mins & then throws following error:
    Error occured while opening document. Document ID = {0}
    The report opens with its header having company log & two buttons, but data grid remains empty.
    The source of Grid is Essbase. The tunning parameters in Essbase.cfg file are in place.
    Could anyone please through more observation on this issue. Let me know if any further information is needed!.
    Kindly suggest me any way to resolve it.
    Thanks,
    Krishan

    The isapi (if you use one) timeout setting might be smaller than the time essbase needs to retrieve te information.
    but most probably the analysis applicationserver jre heapsize is either to small or needs to much time to allocate it. Be sure to increase heapsize and set max equal to min (try 800mb, if your hardware has that resource)

  • WebAnalysis Error: Error occured while opening document. Document ID = {0}

    Hi Experts,
    I am having an issue while opening a web analysis dashboard report. When I try opening it, web analysis runs for about 15 mins & then throws following error:
    Error occured while opening document. Document ID = {0}
    The report opens with its header having company log & two buttons, but data grid remains empty.
    Kindly suggest me any way to resolve it.
    Thanks,
    Krishan

    Hi Natesh,
    Thanks for your reply to my query posted in this forum. Please find my inline answers between asterisk to your questions:
    Whatz the source of your Grid? Relational SQL Query (OR) A spreadsheet with Essbase database connection file?
    * Yes, the source is Essbase.*
    If source is Essbase, it seems- Outline might've got altered when you're trying to refresh the report.
    * The outline was in tandem when we tried running this report in WebAnalysis. This outline & WebAnalysis report which is in Dev Server is a replica of the one in Test Server where it runs fine. *
    If source is based on a Relational SQL query, chances are that- Query is no longer valid.
    * NA as this statement is NOT applicable to our source.*
    If it's Essbase, it's also likely that- It ran out of time while fetching the data from Essbase. You may try playing around with the parameters in Essbase.cfg file.
    * This might be one of the causes, but I double checked the all the tunning parameters in Essbase.cfg file in place.*
    Could you please through more observation on this issue. Let me know if any further information is needed!.
    Thanks for your time.
    Regards,
    Krishan
    Edited by: user10475612 on Nov 8, 2009 1:07 PM
    Edited by: user10475612 on Nov 8, 2009 1:09 PM
    Edited by: user10475612 on Nov 8, 2009 1:12 PM

Maybe you are looking for