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.

iOS and MacOS / 'Files' in iOS - I just don't get it!

Author
Message
Jambo B
8
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 29th Dec 2014 17:06
Hello all,

I'm a newbie to iOS. I’ve managed to get my app running now on my iPad (Woo!), however I’m most confused by FILES in iOS.

On Windows and mac, there's obviously the user's documents directory where my program can save files (e.g. with a 'Save As…' option.)

On iOS, apps such as 'Pages' do store their own files – but where?! iCloud?

I'd like my app to be able to export text files from the app – but where would these actually go? getdocumentspath(), when run on iOS, gives a long path. Should I try to save there?

Thanks in advance for any advice,

James
xGEKKOx
8
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 31st Dec 2014 02:09
Are you coding in Tier 1 or Tier 2?
In Tier 2 you must use OBJ C to do that and give to the app the file permissions in the project.
Apps are sandboxed so you can't do all what you can, but only some things.

Explain me what you wanna do.

Jambo B
8
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 31st Dec 2014 16:21 Edited at: 31st Dec 2014 16:23
Hi Gekko - thanks for your help.

I'm using Tier 1.

Part of the app involves a list of words which the user can edit. The words can be exported so that the user can share them with someone else, or as a backup.

I've got this working in Windows:

+ Code Snippet

...but of course, iOS does not support the raw path thing. How would the user save their word lists (to share with someone or as a backup)?

Thanks again,

James
Ancient Lady
13
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 2nd Jan 2015 01:36
Jambo B, you don't need to set the write path for any platform.

If you just use the default, AppGameKit takes care of the rest.

For initially opening a file, it will look in the media directory.

If you want to update the file, AppGameKit then writes it to the sandbox area appropriate to the platform. Subsequent reads of the file will use that location and the one in the media directory will be ignored.

This holds true only when the file name is the same.

You can create a new file with the appropriate commands and it will automatically be stored in the sandbox area.

I found it generally safer to not mess with commands that changed the active directory. They may be better in V2, but in V1, they always caused me problems.

You can use directory paths like '/media' and '/media/somesubdir' to explicitly set where you want to work. The AppGameKit app will create a media directory (and any subs) that are indicated in the sandbox area for any new or updated files.

Cheers,
Ancient Lady
Ancient Lady
13
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 2nd Jan 2015 01:37
I just read your post in a bit more detail. Sharing and backing up dynamic files in platforms other than Windows doesn't work very well.

Unless you have a web server and code to store the files online for backup or sharing. Which is doable.

Cheers,
Ancient Lady
xGEKKOx
8
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 2nd Jan 2015 01:45 Edited at: 2nd Jan 2015 01:47
You need Tier 2 to do what you wanna do, giving it the Xcode write/read permission.
You need to save data with FileManger Object.

Or using Tier 1 using always the same dir i think.

When i used on c++ the agk save files, i use it without specifing the folder.
So i use the default assigned, i think the one in resource, where i save the game settings.

Jambo B
8
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 3rd Jan 2015 12:47
Thanks, AL and Gekko, for all the advice. I think I'll look at the webserver option for iOS. I used to do a bit of asp coding back in the day. I'll have a go at setting up a backend database.

Thanks again,

James
Ancient Lady
13
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 10th Jan 2015 23:10
Jambo B, you will need a web server in the public domain if you want your application to work for everyone.

Many hosting companies provide good Linux based servers, running Apache, MySQL and supporting PHP. That combination allows for fairly quick network setup and can be easily changed.

Where I work now, we have a mix of server types. And I work in PHP and asp on DNN networks. In my opinion, programming in asp is a royal pain in the rear. PHP is easy (no compilations).

And, you are likely to find a wider variety of hosting companies for PHP based sites.

Asp requires using a Windows based server (much easier to hack than Linux). It is a lot more headache and overhead for hosting providers.

If you have your own server, obviously whatever works for you is best.

Cheers,
Ancient Lady
Jambo B
8
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 11th Jan 2015 02:01
Right, that's decided then. I'll go for PHP, MySQL and Linux. Think I'd better get reading up on these things - always been a Windows man myself!

Thanks, Ancient Lady, for your advice - much appreciated!

James
Ancient Lady
13
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 11th Jan 2015 20:34
Good luck.

I am not in the forum as often these days because I now have a full time job with the Alaska Railroad (in Anchorage, Alaska). But, if you need help, I can try.

Based on my own experience and that of clients, if you haven't already picked a hosting agent, I highly recommend JaguarPC (www.jaguarpc.com).

They have some inexpensive shared hosting plans (which is probably all that you need). You can get an SSL certificate on them (which might be required by Apple for some things, if you use the Push services).

If you do decide to use them, please start at one of my stub sites (www.triassichost.com) and click on one of the Jag links. I get about a $25 credit if someone signs up based on my referal using one of those links. Yup, this is a shameless bid (and I recommend them even if you don't use a link from my page, they really are very good).

Cheers,
Ancient Lady
Jambo B
8
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 13th Jan 2015 19:25
Hi Ancient Lady.

I have hosting at the moment for my website, which can run PHP and a database setup via CPanel. I have still got to research certificates to get a secure connection.

Having said that, I will definitely have a look at JaguarPC and will DEFINITELY use your referral link if I sign up... hope anyone else reading this will as well! as a thanks for your help and advice!

Ta again,

James
Ancient Lady
13
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 15th Jan 2015 04:53
Good luck and Happy Programming!

Cheers,
Ancient Lady

Login to post a reply

Server time is: 2017-09-19 14:36:15
Your offset time is: 2017-09-19 14:36:15