Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / saving and openeing files?

Author
Message
Gibbon28
12
Years of Service
User Offline
Joined: 22nd Oct 2012
Location: Derbyshire, UK
Posted: 29th Oct 2012 17:57
Hi, im trying to find more or specific information regarding saving and loadnig files to and from devices?

How can this be done on IOS?

Is there a spcific folder for files? Also what "file" types can i save.

Im wanting to esentially save a files with some store variables in? So a textfile or ini file would be what im after.#

Thanks
Andy
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Oct 2012 18:17
First, are you using Tier 1 or Tier 2?

If you are using Tier 2, all input files start in a directory named 'media' (which is also where you put your bytecode.byc file). You need to add the media directory to the Resources folder in your Xcode project. Make sure that "Create folder references for any added folders" is ticked next to "Folders" in the dialog that pops up to select your media directory. This makes sure that any sub-directory names and structure are maintained and available to your app. Then select the media directory (not the files, but the actual directory the first time).

If you are using Tier 2, I would still recommend having a directory named media in your project (both Windows and Xcode) to keep the media separate and easy to identify. You would make sure to add "/media/" to file references.

Tier 1 looks specifically for a directory named 'media' by default. Tier 2 does not.

When you create or update a file by writing one, it creates the file in the appropriate sandbox area for the platform. In Windows it is Documents\AGK\<yourappname>\media (for Tier 1). Plus any subdirectory under media (Tier 1) or your main app (Tier 2). After the file is written there, if there is a file of the same name in <yourappexecdir>/media, the app will use the one in the sandbox area the next time it reads it. Other platforms create similar directories somewhere (usually hard to find).

Cheers,
Ancient Lady
AGK Community Tester
Gibbon28
12
Years of Service
User Offline
Joined: 22nd Oct 2012
Location: Derbyshire, UK
Posted: 29th Oct 2012 18:20
At the moment im using tier 1.

So for me to write and read on ios, i simply have to writetofile giving it a name and IOS will sort out where?

then when i goto read the file back using the given name it will be avaialable?

Am i correct?
thanks
Andy
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Oct 2012 18:38
Quote: "Am i correct?"


Yup, that's about how it works. This applies to all platforms, not just iOS.

Cheers,
Ancient Lady
AGK Community Tester
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 29th Oct 2012 20:12
Quote: "If you are using Tier 2, all input files start in a directory named 'media' (which is also where you put your bytecode.byc file)"


You ment Tier 1 here

Follow me on twitter! @MotionStruct
Motion Struct blog
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Oct 2012 20:32
Yes, you are correct. That was a fumble finger moment (blame it on the winds outside right now).

If you are using Tier 1, all input files start in a directory named 'media' (which is also where you put your bytecode.byc file).

Cheers,
Ancient Lady
AGK Community Tester

Login to post a reply

Server time is: 2024-11-24 01:17:35
Your offset time is: 2024-11-24 01:17:35