GLBasic forum

Main forum => GLBasic - en => Topic started by: Hark0 on 2012-Apr-04

Title: INI files really work on iOS? (IPad1)
Post by: Hark0 on 2012-Apr-04
Hi!

I'm are testing my app on iPad1. In my source code I use two kind to access files. One using READBYTE, WRITEBYTE... and other files using INIGET$ and INIPUT...

On Windows all work perfectly, but on iPad only works file byte handling... INI files maybe not loaded correctly... and not save nothing too...

Any notice about this matter?

Regards.
Title: Re: INI files really work on iOS? (IPad1)
Post by: tatakamucher on 2012-Apr-04
to save a ini file reopen the file, that works for me :S
Title: Re: INI files really work on iOS? (IPad1)
Post by: BdR on 2012-Apr-04
Remember, on iPhone/iPad you can only write to files in certain folders, you should use PLATFORMINFO$("DOCUMENTS"). I'm not sure but maybe PLATFORMINFO$("APPDATA") also works.

Here's an example of how I do it in my game, and this works also on iOS:
Code (glbasic) Select
CONSTANT SETTINGS_FILE$ = "/mygame.ini"

// save settings
INIOPEN PLATFORMINFO$("DOCUMENTS") + SETTINGS_FILE$
INIPUT "gamesettings", "level", CurrentLevelNr
INIOPEN ""

// load  settings
INIOPEN PLATFORMINFO$("DOCUMENTS") + SETTINGS_FILE$
CurrentLevelNr = INIGET$("gamesettings", "level", "1") // 1 = default level
INIOPEN ""

Title: Re: INI files really work on iOS? (IPad1)
Post by: Zapp on 2012-Apr-04
Yes, on IOS, you need to write to the documents folder or it will fail.

I've also had a similar issue on IOS with opening files that dont exist in order to create a new player save file, it works on Windows, but on IOS I see it crash on my xcode when I'm running it on the device. The work around I have at the moment is to have a dummy blank file already existing for the player slots, but it would be nice to know whats causing this on IOS only and how I could resolve it.
Title: Re: INI files really work on iOS? (IPad1)
Post by: Hark0 on 2012-Apr-05
Hi!

My PATH are correct...

I use the SAME path for both files (bin/ini)...

INI save/load get xcode log error for write/read...

I'm converted my INI values to byte and used ONLY readbyte/writebyte...

:blink:


@tatakamucher: How? Can you explain?
Title: Re: INI files really work on iOS? (IPad1)
Post by: tatakamucher on 2012-Apr-05
Code (glbasic) Select


ruta$=PLATFORMINFO$("Documents")
INIOPEN ruta$+"/example.ini"

INIPUT "hello", "hello1", 1

INIOPEN ruta$+"/example.ini"



Title: Re: INI files really work on iOS? (IPad1)
Post by: Hark0 on 2012-Apr-05
Quote from: tatakamucher on 2012-Apr-05
Code (glbasic) Select


ruta$=PLATFORMINFO$("Documents")
INIOPEN ruta$+"/example.ini"

INIPUT "hello", "hello1", 1

INIOPEN ruta$+"/example.ini"


THANKS!!!! I try in next use of files....  :good: