How easy is it for a user to remove files from NSLibraryDirectory? - objective-c

I was wondering how easy it is to remove files from the NSLibraryDirectory? I want to store some data there that I don't ever want to be removed from the device. The files are big and I have tried to encrypt them, but it takes 30-60 seconds for the files to decrypt to be displayed on the iPad and this is just too long so I didn't want to encrypt them.
If anyone can tell me how hard it would be for someone to get these files off of the iPad or have another solution of how to protect them that would be great. Thanks!

Each app has a sandbox that includes a Documents folder that you can use to organize and save resources. On a non-jailbroken device no other app will ever have access to that folder. This folder will be deleted if your app is removed from the device.
On a jailbroken device all bets are off unless you use encryption.

Related

Check if Dropbox has synced

Before I look into this any further I just wondered if it's possible within VB.net to check if DropBox has synced?
Basically the program I have written uses DropBox to synchronize jobs to a Main computer which then ultimately process the zip file and deletes it. Once the job is processed a text file is re synced and the person who originally sent the job gets feedback as to its progress. All this works great. However, I would like to give an indication within the program itself so some of the less computer literate can see that DropBox has synced and they can safely turn off there laptops and head off home.
Has anybody any experience of this?
You could use the Dropbox API to do the upload/download instead, at which point you'd know exactly when things had happened.
See https://www.dropbox.com/developers for information about the API.

In OSX (Mountain Lion) Only allowing an application to open if a condition is met

Is there any simple way to do this?
I basically want iTunes to not open if an external hard drive is not connected. This is essentially a user issue - as despite asking multiple times, my girlfriend will forget and open an audio or video file without the external HDD connected (where the iTunes library is kept) and so the usual rigamarole occurs... the media file will then try and add itself to the iTunes library, which can't be found, so it'll default back to it's position on the internal hard disk, and then when I come to use it, it'll try and consolidate it for me (which is nice), except it then decides it needs to organise it - and this takes about 6 hours due to the amount of music I have on there.
I've tried changing the internal (default) iTunes music folder path to an alias to the external one, but that starts throwing out some beastly errors once you get into the loop (when the alias is essentially a pointer to an invalid location).
Is Automator something that could be used? Sorry I'm not very pro with OS X I'm afraid.
Thanks,
Duncan
It seems a straightforward way to do this is just to move the iTunes.app onto the external hard drive, and replace iTunes.app in the Applications folder with an alias pointing to iTunes on the external HDD (called iTunes).
As iTunes is system protected, you'll need to change the permissions of iTunes.app to move it, which you can do via gui or terminal (sudo chmod...)
Simples.

win8 store app access local storage

I am developing a Win8 Store app which allows users to download different types of files from an online learning platform and store them locally. I am also considering the function to help users organize these downloaded files by placing them in different folders (based on course name and etc.).
I was using Documents Library previously. But for every type of file that the user could download, I need to add a file type association, which does not make a lot of sense since my app would be able to open such files. So which local storage should my app use?
Many thanks in advance.
Kaizhi
The access to storage by Windows Store apps is quite restrictive, especially the DocumentsLibrary.
As you have noticed, you need to declare a file type association for every file type you want to read from or write to the DocumentsLibrary. This means your app need to handle file activations for these types in a meaningful way, which your app probably should not do.
But even if you jump through this hoop, there is another one that is not documented on the MSDN page of the DocumentsLibrary, but "hidden" in a lengthy page about app capability declarations: According to the current rules, you are not allowed to use the DocumentsLibrary for anything but offline access to SkyDrive! Bummer...
So what's left?
You can use SkyDrive or another cloud storage to put files in a well known place (which might or might not be somewhere on the hard disk). This is probably both overkill and undesirable in your case.
Or you save the files in the local app storage, provide your own in-app file browser and open the files with their default app. Seems viable to me.
Or, maybe, you can do something with share contracts or other contracts. I don't know much about these yet, but I doubt that they are helpful in your situation.
And that's it...
(Based on my current experience. No guaranty for correctness or completeness)

ios pList security

I'm just getting into saving data from my game into a .plist, but I'm a bit unclear on how secure that is.
I'll be saving the players entire game state (including tile map data) in a plist(s). As I understand it you can't modify a plist in the bundle, but all the example code i've seen creates a new dynamic plist which is stored in the documents? is this easily changeable by the player from their phone?
is this easily changeable by the player from their phone?
Only if they have access to it - a fact of which the prerequisite is the phone being jailbroken. But in this case, yes they can modify it easily.
The plist files can be easily modified even without a jailbreak -
iExplorer allows to browse the iPhone application folders over an USB connection. In this case, the plist file can be copied from the iPhone to a computer, modified and loaded into iPhone.
Plist files are stored unencrypted on the backup. So the file can be modified in the backup and restored into iPhone.
Use keychain for better security. To make it more secure, use custom crypto and encrypt the game state before storing it on the device.

iPad - how should I distribute offline web content for use by a UIWebView in application?

I'm building an application that needs to download web content for offline viewing on an iPad. At present I'm loading some web content from the web for test purposes and displaying this with a UIWebView. Implementing that was simple enough. Now I need to make some modifications to support offline content. Eventually that offline content would be downloaded in user selectable bundles.
As I see it I have a number of options but I may have missed some:
Pack content in a ZIP (or other archive) file and unpack the content when it is downloaded to the iPad.
Put the content in a SQLite database. This seems to require some 3rd party libs like FMDB.
Use Core Data. From what I understand this supports a number of storage formats including SQLite.
Use the filesystem and download each required file individually. OK, not really a bundle but maybe this is the best option?
Considerations/Questions:
What are the storage limitations and performance limitations for each of these methods? And is there an overall storage limit per iPad app?
If I'm going to have the user navigate through the downloaded content, what option is easier to code up?
It would seem like spinning up a local web server would be one of the most efficient ways to handle the runtime aspects of displaying the content. Are there any open source examples of this which load from a bundle like options 1-3?
The other side of this is the content creation and it seems like zipping up the content (option 1) is the simplest from this angle. The other options would appear to require creation of tools to support the content creator.
If you have the control over the content, I'd recommend a mix of both the first and the third option. If the content is created by you (like levels, etc) then simply store it on the server, download a zip and store it locally. Use CoreData to store an Index about the things you've downloaded, like the path of the folder it's stored in and it's name/origin/etc, but not the raw data. Databases are not thought to hold massive amounts of raw content, rather to hold structured data. And even if they can -- I'd not do so.
For your considerations:
Disk space is the only limit I know on the iPad. However, databases tend to get slower if they grow too large. If you barely scan though the data, use the file system directly -- may prove faster and cheaper.
The index in CoreData could store all relevant data. You will have very easy and very quick access. Opening a content will load it from the file system, which is quick, cheap and doesn't strain the index.
Why would you do so? Redirect your WebView to a file:// URL will have the same effect, won't it?
Should be answered by now.
If you don't have control then use the same as above but download each file separately, as suggested in option four. after unzipping both cases are basically the same.
Please get back if you have questions.
You could create a xml file for each bundle, containing the path to each file in the bundle, place it in a folder common to each bundle. When downloading, download and parse the xml first and download each ressource one by one. This will spare you the overhead of zipping and unzipping the content. Create a folder for each bundle locally and recreate the folder structure of the bundle there. This way the content will work online and offline without changes.
With a little effort, you could even keep track of file versions by including version numbers in the xml file for each ressource, so if your content has been partially updated only the files with changed version numbers have to be downloaded again.