FileAccess Issues with iOS (wierd, but minor).

Previous topic - Next topic

spacefractal

for some reason, but have no clue why yet, Glbasic can crash out when READSTR fails with a GLB Error: 3.

Code (glbasic) Select

FUNCTION LINEREAD$: FileNr
LOCAL chda$, L$=""
IF ENDOFFILE(FileNr) THEN RETURN ""

REPEAT
DEPRINT("l1")
IF ENDOFFILE(FileNr) THEN BREAK
DEPRINT("l2")
READSTR FileNr, chda$, 1
DEPRINT("l3")
L$=L$+chda$
DEPRINT("l4")
UNTIL ASC(chda$)=10
DEPRINT("l5")
L$=TRIM$(L$)
RETURN L$
ENDFUNCTION

Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

kanonet

IIRC GLB Error:3 is file not found error. Are you sure that the file is where you try to open it?
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

spacefractal

#2
the filesize is 92bytes and its open fine with OPENFILE without trouble and even detect the filesize pretty fine too as well checking ENDOFFILE too.

But for some reason some wierd happens when trying read that file with READSTR.

im trying to read a iCloud file, which is in a complete different folder. So its property look like its a issue with the channel, so glbasic add something to the string, which its should not.

But glbasic should not crash like that, but still gracefull send to a OK variable.

Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Moru

I tried the above code together with my own DEPRINT that just does a DEBUG of the string. Works just fine with my usual testfile. What exactly is the code before this function that opens up the file, what is the path and how does the the file itself look?

spacefractal

#4
because im uses various STDOUT thing on DEPRINT, im just forget to remove that. dont worry. the issue is not there.

Im came thinking its the same issue im have with iCloud file, a year ago. glbasic cannot read the file, but its can write to it. Its some sort a permission issue. Howover you do can COPYFILE it and then read it, now its works.

Its would veen nice if glbasic diddent crash due something like that, but instead still the file is missing or failed to read.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Moru

If you deleted the file and it works fine now, it could have been locked by your program earlier and not released when the program crashed. This means you have to shut down the GLBasic IDE and restart it. In worst case you will have to restart the whole computer to get the lock released :-)

There should be no problem reading a small file as long as you don't try to read beyond the end of the file.

spacefractal

#6
there is some trouble right now. Not even COPYFILE works from the private folder (hence im rename the topic).

Its some sort of odd read permission error and have no clue why its dosent work by now.

here is the output im got when im just trying to get COPYFILE to work:

Code (glbasic) Select

[GLB]->Read From iCloud
[GLB]->/private/var/mobile/Library/Mobile Documents/***62N3PZ*~com~spacefractal~karmamiwa/KarmaMiwa_Save.ini 396
request: fopen("/var/mobile/Applications/89BD9CFE-A0B0-44CE-905B-335160CD3DE9/Documents/.glbasic/KarmaMiwa_CloudSave.ini", "rb") failed
error: 3
[GLB]->/var/mobile/Applications/89BD9CFE-A0B0-44CE-905B-335160CD3DE9/Documents/.glbasic/KarmaMiwa_CloudSave.ini 0
[GLB]->------------
[GLB]->/private/var/mobile/Library/Mobile Documents/***62N3PZ*~com~spacefractal~karmamiwa/KarmaMiwa_Save.ini 396
request: fopen("/var/mobile/Applications/89BD9CFE-A0B0-44CE-905B-335160CD3DE9/Documents/KarmaMiwa_CloudSave.ini", "rb") failed
error: 3
[GLB]->/var/mobile/Applications/89BD9CFE-A0B0-44CE-905B-335160CD3DE9/Documents/KarmaMiwa_CloudSave.ini 0


As you see after copy the file, the size is still 0 (the original file is 396 bytes), even im uses PLATFORMINFP$O to get the folder (using both document and appdata). This is a wierd issue. So by now iCloud support is no longer works due this issue.

Im just a least needs a way to get the file copy to the internal app document folder, and then read from here (which have works eariler iOS versions).
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrTAToad

Are you writing to a location that is allowed ?

spacefractal

Yes, the location glbasic give me. It all works with internal. I'm can write to the private iCloud folder too without issue, but fails to read it.

I'm see can checkout a xcopyfile() function doing the filecopy from Xcode instead...
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

spacefractal

The sticky thread im have with iCloud, that can safe been removed the sticky, because its no longer work and will no longer try to get it work again. Its simply just crap to work with.

But instead im will looking on iCloud KeyValue thing as the alternative metode to load and save keys intead.

PS. This thread can been safe to been moved to the glbasic_en thread. Gernot can do nothing with this issue at all.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Moru

Moved topic and unstickied.

I didn't understand that you had the problem just with iOS at first so can't really help you. I don't have any apple products to test on. The stuff I was talking about only happens on the device you run GLBasic IDE on.

kanonet

Quote from: spacefractal on 2014-Sep-05PS. This thread can been safe to been moved to the glbasic_en thread. Gernot can do nothing with this issue at all.
Does this mean this is a limitation in iOS, or why cant it get fixed?
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

spacefractal

I'm don't know. It's some sort of wierd file permission issue, when trying read the cloud file.

So I'm dropping its, but intead looking on the key database instead.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/