Add External Data

This isn’t a XOJO specific question, as much as an iOS procedureal one.

What process flow would you (or can you?) implement, so that a user can add a read-only TEXT FILE (csv or something similar) to an application specific folder on an iPhone/iPad?

What I’m thinking is the app would come with pre-installed “templates”, and in the future instead of upgrading the whole application, somehow (and this is where I’m cloudy), the user could take this “text file” and “install it”… And could this be done in a manner that Apple would accept? The file doesn’t contain “code”, but it would be “data”.

The idea is the app would be a “rules engine” for a type of game, and the text file would describe various implementations

[quote=189868:@Dave S]This isn’t a XOJO specific question, as much as an iOS procedureal one.

What process flow would you (or can you?) implement, so that a user can add a read-only TEXT FILE (csv or something similar) to an application specific folder on an iPhone/iPad?

What I’m thinking is the app would come with pre-installed “templates”, and in the future instead of upgrading the whole application, somehow (and this is where I’m cloudy), the user could take this “text file” and “install it”… And could this be done in a manner that Apple would accept? The file doesn’t contain “code”, but it would be “data”.

The idea is the app would be a “rules engine” for a type of game, and the text file would describe various implementations[/quote]

Activate file sharing in iTunes ?

Ok… I’m still quite lost here… “file sharing in iTunes”
first off I can find no such “feature”, “menu item” etc… (not surprising as iTunes must be the worlds most intuitive app)

I do see other apps that I have on my iPad the show in a “File Sharing” window under “APPS” in iTunes, but that doesn’t address what MY app needs to do to be included, and once it is included how to add a new file, where that file goes (in relation to the iOS app), and therefore how the iOS app can read it.

When I click on one of those “apps listed below can transfer documents between your iPad and this computer”… is that file list from the iPad, or is it a hidden folder somewhere on my Mac.

I have spent hours with Google, and this topic seems to be one that is not addressed …

[quote=190988:@Dave S]Ok… I’m still quite lost here… “file sharing in iTunes”
first off I can find no such “feature”, “menu item” etc… (not surprising as iTunes must be the worlds most intuitive app)

I do see other apps that I have on my iPad the show in a “File Sharing” window under “APPS” in iTunes, but that doesn’t address what MY app needs to do to be included, and once it is included how to add a new file, where that file goes (in relation to the iOS app), and therefore how the iOS app can read it.

When I click on one of those “apps listed below can transfer documents between your iPad and this computer”… is that file list from the iPad, or is it a hidden folder somewhere on my Mac.

I have spent hours with Google, and this topic seems to be one that is not addressed …[/quote]

See https://forum.xojo.com/18037-how-to-get-database-into-out-of-ios-device/0#p150200

You are totally misunderstanding the requirement… Adding resources at build time is not the issue. it is adding resources AFTER deployment.

Say someone buys my SuperApp27, that comes with 100 free templates,

Six months down the road I develope 50 more templates. Note these are DATA (csv files to be exact), not code, not an upgraded app.

So if they “install” this csv file, the app now has 150 templates. It would look in some location, and determine if a file or files existed at this location, and if so, would read them while the app was initializing… If there were no files there, then it would offer the “built-in” data only.

Somehow there is a way to add code to the app (before deployment) that designates that it is allowed to accept and store external files for it to use. THIS is what I am trying to figure out

[quote=191005:@Dave S]You are totally misunderstanding the requirement… Adding resources at build time is not the issue. it is adding resources AFTER deployment.

Say someone buys my SuperApp27, that comes with 100 free templates,

Six months down the road I develope 50 more templates. Note these are DATA (csv files to be exact), not code, not an upgraded app.

So if they “install” this csv file, the app now has 150 templates. It would look in some location, and determine if a file or files existed at this location, and if so, would read them while the app was initializing… If there were no files there, then it would offer the “built-in” data only.

Somehow there is a way to add code to the app (before deployment) that designates that it is allowed to accept and store external files for it to use. THIS is what I am trying to figure out[/quote]

The thread I linked to is about EXACTLY what you describe.

The iTunes file share lets you add documents to your app the same way as,PDFReader or other ones, through iTunes. Then the documents are available to your app in the Documents folder. Looks to me your csv could go in there.

You app accesses these documents with a folderItem. No need for special code apart from the plist. Just look in the folder.

my apologies… for some reason that is not where the link took me before… it took me to a link that basically said “drag it to the ide”, which was not what I wanted… thanks

What Michel suggest will work by connecting to a computer.

I suppose the user could copy and paste the data from your website or an email, but the raw data would be exposed.

Another way would be to have an ‘Update’ button in the app that would hit a webpage that contains the data which you could then download. You could also have a web page with the current version number of the data and a description to let them know that it’s newer than what they have on the device.

Thanks… seems that this can’t be done in the “simulator” so I’m guessing you have to install via TestFlight since it has to be exposed to iTunes for this to work

or copy the app directly to an iOS device using Xcode

The whole idea it to update the app with new templates after the customer has already installed the app. They may not have XCODE (and mostly likely wouldn’t). So I need a way to deliver a file to them that they can transfer to their iPhone, for my app to use.

I mentioned Testflight, becuase while I can run the app on my iPad via Xcode, it is not visible to iTunes on the connected Mac… something that I would assume would require TestFlight to do (other than an actual AppStore deployment of course)

Dave, I think you just need an “Update” button that would use an HTTPSocket with either GET or POST to dl the text from your website or another url. The user won’t see a thing.

You are right, apps installed with XCode do not appear in XCode. You could prepare the picking up of the file, though. Documents exchanged through iTunes file sharing go to the Documents folder of your app’s container. So it is easy to simulate it with SpecialFolder.

But I like very much Hal’s idea. For Elementary Letters, I use a web service in Xojo Web that my app calls, then it shows URL through Safari a coded URL to the web app, which sends the font to install on the device. It is not unlike what your app could do.

The interesting part is that you can update the csv at any time, you could even send new references to documents to the app so it offers more items, and when the user taps on an item, it is downloaded.

No worries about Apple reviewers about such a technique : my app is in the store.

Of course that requires setting up a web service.

So Apple WILL allow you to have an app, that downloads data from a non-apple server, stores it in a app-centric directory on the I device without the user ever actually “seeing” the data???
What if the developer (me) wished to sell this content? since it isn’t IAP, then apple doesn’t get their 30%

I’m trying to figure out where “the line” is so I don’t develop a process that “works” only to have Apple shoot it down and delay approval of the final app.

Based on Hal’s idea. The user would push a “Get new templates” button on the I device, it would then look in the local “/Documents” determine what templates have already been downloaded (if any), then go to my website, get a list of available templates and offer up a picklist of the “not yet downloaded” ones to choose from.

Too simple…

add this to you PLIST

<key>UIFileSharingEnabled</key>
    <true></true>

Then the app will show up in iTunes (assuming you are running on a real device [not simulator]), just drag a file into the list, and it will appear in the /DOCUMENTS folder on the device.

No HTTP, No web services, no IAP

[quote=191556:@Dave S]So Apple WILL allow you to have an app, that downloads data from a non-apple server, stores it in a app-centric directory on the I device without the user ever actually “seeing” the data???
What if the developer (me) wished to sell this content? since it isn’t IAP, then apple doesn’t get their 30%[/quote]

Lots of apps do this. Apple’s line in the sand seems to be around where the payment for the service occurs. If you have a mechanism for users to sign-up for a subscription or one-off payment within your app then Apple wants its 30%. But if your users sign up externally to the app - for example on a web site - and the app just “synchronises” content as opposed to offering content for purchase, then you can avoid paying Apple.

My app is a mobile client for our subscription online product. My app allows users to sign-up within the app for a totally free, but limited, account. If a user wants a full subscription they need to sign-up with their credit card on my web site. An associate of mine did a similar thing but initially he also allowed users to sign-up for a paid account within his app and was pinged by Apple for this. By removing the paid in-app sign-up he was able to get his app approved.

[quote=191561:@Jason Tait]Lots of apps do this. Apple’s line in the sand seems to be around where the payment for the service occurs. If you have a mechanism for users to sign-up for a subscription or one-off payment within your app then Apple wants its 30%. But if your users sign up externally to the app - for example on a web site - and the app just “synchronises” content as opposed to offering content for purchase, then you can avoid paying Apple.

My app is a mobile client for our subscription online product. My app allows users to sign-up within the app for a totally free, but limited, account. If a user wants a full subscription they need to sign-up with their credit card on my web site. An associate of mine did a similar thing but initially he also allowed users to sign-up for a paid account within his app and was pinged by Apple for this. By removing the paid in-app sign-up he was able to get his app approved.[/quote]

Apple will bump any app that has payment forms or Paypal buttons within it. Normal, they have in app purchase for that. I know Jason King is working on that, so with some luck you will have that at some point.

In the meantime, I have placed an HTMLViewer in the app that points to my web site where they can purchase more fonts. I have done that as well for the half dozen apps I have in the MAS for years without any frown from Apple.

FYI Michel I’m not the OP :). I don’t want in-app purchase. My service is a separate, subscription service and my iOS app is just a client for this. I don’t want to share revenue with Apple; I was just sharing advice I have received with the OP. :slight_smile:

Sorry.

No problem. :slight_smile: