File Sharing Through iTunes exposes all files in Documents directory

Hi Ansca Team,

I’ve setup the UIFileSharingEnabled=true in build settings file, which is great because I get to expose files to the user through the iTunes share functionality.

HOwever, my application requires to write to a sqlite database. This means I have to place a copy of it in the document directory in order to be able to write to it without violating the security rules on iOS for example. But you get where I’m getting at…currently, I want users to be able to take the pdf files they see in the app, and when they get to the iTunes sharing thing, well, they also see my nice little sqlite databases files…

The solution would be to be able to write to the apps home library directory, which is allowed by Apple (see following apple Q&A: http://developer.apple.com/library/ios/#qa/qa1699/_index.html).

However, Corona has sandboxed only 3 directories: tmp, resources, and documents.

Even though my target is mostly iOS, I personally prefer to use Corona SDK because it allows for faster development cycles on iOS than by coding in this extremely verbose Obj-C language, so I frankly wouldn’t mind if this wasn’t possible at first on Android !

Any chance to get this anytime soon ? [import]uid: 23043 topic_id: 20694 reply_id: 320694[/import]

You might be able to hide the sensitive files by prefixing the filenames with a full stop.
I havent treid it, but it hides files in OSX… [import]uid: 108660 topic_id: 20694 reply_id: 81263[/import]

Genius! This actually hid it from the iTunes Shared files.

I must now try this is my code to make sure that sqlite lua api will accept a file starting with a full stop (i don’t see why it wouldn’t), and if the native web view will accept viewing a local html file starting with the full stop as well (because the pdfs are being displayed through a web view using dynamically generated html files which embed the pdf file requested to be displayed)

Well, I’ll let you know my findings… [import]uid: 23043 topic_id: 20694 reply_id: 81265[/import]

Well, this actually works in the Corona Simulator, but FAILS on the both the iOS simulator and on my iOS device.

The message I get from the Xcode console in the organizer window is:

Lua Runtime Error: lua_pcall failed with status: 2, error message is: bad argument #1 to ‘open’ (string expected, got nil)

I only have 2 lines of code that call an open method on an object, which are:
db = sqlite3.open( path )
file = io.open( path, “r” )

So either way, this solution isn’t a working one I’m afraid, but hey, it gave me the chills when tried it and the simulator and worked in it !!! It was a good shot! [import]uid: 23043 topic_id: 20694 reply_id: 81271[/import]

Actually, the native web view has no trouble opening local html files starting with a full stop.

But I confirm that the SQLite lua API does NOT open a database file starting with a full stop when running on the device…what a shame… [import]uid: 23043 topic_id: 20694 reply_id: 81275[/import]

Okay, this person had a similar error to yours. I’m a pretty big noob, but maybe this could help.

http://developer.anscamobile.com/forum/2012/01/19/android-application-has-been-corrupted-luapcall-failed-status-2 [import]uid: 46082 topic_id: 20694 reply_id: 81276[/import]

I know that this might be the same thing, but what if you tried to put your sqlite database in a hidden subfolder in the Documents folder ( .data/mydatabase.db ) ? [import]uid: 70847 topic_id: 20694 reply_id: 81284[/import]