1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

iOS Bug with file functions in iOS? Creating a file does not seem to work, "no such file" error.

Discussion in 'GameMaker Studio 2 Community Tech Support' started by Guest, Jul 24, 2019.

  1. Guest

    Guest Guest

    I check for the existence of a file and, if it does not exist, create it, like so:

    Code:
    global.privacy_consent = false;
    if (!file_exists("privacy_consent.bhsl"))
        {
        show_debug_message("* Privacy_consent.bhsl did not exist, creating it.");
        var privacy_consent_map = ds_map_create();
        privacy_consent_map[? "consent"] = false;
        var privacy_consent_map_string = ds_map_write(privacy_consent_map);
        var f = file_text_open_write("privacy_consent.bhsl");
        file_text_write_string(f, privacy_consent_map_string);
        file_text_close(f);
        ds_map_destroy(privacy_consent_map);
        }
    if (file_exists("privacy_consent.bhsl"))
        {
        show_debug_message("* Reading privacy_consent.bhsl.");
        var f = file_text_open_read("privacy_consent.bhsl");
        show_debug_message("* Should have successfully opened privacy_consent.bhsl.");
    
        var privacy_consent_map_string = file_text_read_string(f);
        var privacy_consent_map = ds_map_create();
        ds_map_read(privacy_consent_map, privacy_consent_map_string);
        global.privacy_consent = privacy_consent_map[? "consent"];
        file_text_close(f);
        ds_map_destroy(privacy_consent_map);
        }
    But running on an iPad using the VM and debugger, I get these errors and this output:

    Code:
    2019-07-24 10:37:44.615800-0700 BHSL[251:4819] * Privacy_consent.bhsl did not exist, creating it.
    2019-07-24 10:37:44.619488-0700 BHSL[251:4819] * Reading privacy_consent.bhsl.
    2019-07-24 10:37:44.619724-0700 BHSL[251:4819] Unable to open file  (No such file or directory)
    2019-07-24 10:37:44.621225-0700 BHSL[251:4819] * Should have successfully opened privacy_consent.bhsl.
    
    When I reboot the iPad (to close the game) and try to open the game, it hangs on a black screen rather than running correctly.

    (I'm getting this problem with all my file functions, this was just the simplest example I had to copy and paste.)
     
    Last edited by a moderator: Jul 24, 2019

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice