I have saved a text file from my app and I can open it again, but is there any way the user can gain access to this file to just do whatever they want with it? I tried printing the path which looks like this : /var/mobile/Applications/2DD5A15B-9BC8-4981-A1F6-E22F66C71CA4/Documents/ I'm assuming that huge number is some type of app identifier, which leads me to believe that this file isn't going to be accessible unless you're in the app. Which makes me wonder, why would writing a file be any better than just saving a big string to NSUserDefaults?
I am building an app where the user should be able to do some data logging. If the user can sync their phone with their computer and download the file that would be awesome. Can you do that? Or do I have to build in functionality so that they have to email themselves the file or something?
I'm assuming that huge number is some type of app identifier
It is. It's an UUID.
which leads me to believe that this file isn't going to be accessible unless your in the app
...unless you are in the app (or, unless the device is jailbroken, in which case it's plaintext for anyone interested).
why would writing a file be any better than just saving a big string to NSUserDefaults
Conceptually, it's not a setting. If you have some data, an entity, then write it to a file. NSUserDefaults is not appropriate for storing large amounts of data. It's for storing user preferences (which are volatile!), nothing else.
made of the concept of iOS this is also called sandboxing.
if this would not exist, it could be possible to change or getting data of other apps.
If the user can sync their phone with their computer and download the file that would be awesome. Can you do that? Or do I have to build in functionality so that they have to email themselves the file or something?
you can use the awesome iCloud.
check here:https://developer.apple.com/icloud/index.php
Related
Is there any way to save a file (to be exact, a .csv) somewhere outside the application sandbox? From what I've read it seems like it is only possible to save files inside the sandbox.
Maybe I'm thinking about it the wrong way, maybe I don't really need to save it outside the sandbox. What I actually need to do is:
Allow the user to save the file, so that he can use it in other applications (for example email client), and it would be best if the file would stay on his device after he deleted the app. The location of the saved file doesn't really matter, it could be chosen by user with some file picker or hard-coded. Is there any way to achieve this?
I'm using xamarin.forms so solution easy to implement in xamarin.forms would be much appreciated.
From what I've read it seems like it is only possible to save files inside the sandbox.
That is the general idea. You don't just have access to the filesystem on iOS. You could work around this by maybe saving it to iCloud or Dropbox, etc. depending on your use-case but basically you can't just save it somewhere common. Normally, you would then implement the 'share' functionality. What happens then is that iOS copies the file into the other apps' sandbox so it can work with it.
Could you tell me how would you secure a text file in iPhone app? Let's say you write a text in the app. I would like it to be secured, so even if you have access to the device you still need to enter a specific pin to be able to display the text. I don't want the text to be available on iCloud, only in the specific app itself. Are there any easy and secure ways to do it? I'm total newbie and I will really appreciate any answer :) Have a nice one!
Encrypt the file before saving it to local file system using single key encryption algorithms. Ask the user to enter the key while decrypting, use the key to decrypt and show it :)
How to do it ?
So when user creates/edits a file, create it in temp folder of your app bundle. Content in this folder is not backed up by iCloud and kept temporarily hence the name temp folder :)
Once he is done with editing it, save it in document directory of your app bundle. But because the content in this file can be viewed using third party apps or can be backed up by iCloud, encrypt it before saving it to local document directory.
Which algorithm to use ?
Depends on your requirement. I don't think you need Private and Public Key encryptions looking at your requirement. You can make use of any single key encryption algorithms. I have used https://github.com/RNCryptor/RNCryptor
and it works pretty well. Try it
Happy coding
I am learning iOS file system to store my game data like saving the amount of money earned and things like this in a xml file.
The question is where should I store them?
I read this: File System Basics
And I don't know that I should save data in Documents directory or Application Support directory.
Because the data I want to save is something that is not associated with user's documents and user will never see it so it should be in Application Support, but on the other hand it's something that is affected by user interactions so it should be in Documents.
I think it is the Application Support/MyGame as per the Apple Developer guide link shared by you. You are confused by the fact that it should not be something affected by user interaction. Actually it means user should not directly interact with these. See this from the link: File System Basics
Using something like Parse may slow down your app as it needs to interact with their server, but you do get a backup.
For something of this size, I'd use a mobile backend solutions provider like Parse or Firebase. Personally I use Parse in my projects and is very easy to implement advanced functionality into your apps like user registration/save data to users.
Hope this helps.
I have some app-related parameters (boolean and string data) which are either set by user through the app, either at its first execution. I don't want this kind of information to be stored by using Core Data, so the options I'm thinking about are:
1) Creating and reading/writing a custom .plist file (let's say, myconfig.plist) to be stored in Documents app folder
2) Saving such info using NSUserDefaults
The kind of information I want to keep is, for example, the last app version that was installed and run in order to check if app is being updated, or a flag telling if some specific set of data has been already loaded without having to check the model.
Which of the options would be the most suitable and safest for this task? Or is even there any better option of handling this?
Thanks
try this if you would check appstore version with your actually app version https://github.com/nicklockwood/iVersion
I am trying to understand something that is not clear to me about the storage and access of additional content downloaded from my own server to my iOS app. Clearly this is possible, see the section called Downloading Content from Your Own Server . I understand how to process receipts and how to make a call to my server. What is not understood is:
When I initiate a download from my server what file type does the download need to consist of? Can it be anything I want?
Where I am a supposed to store it on the device considering the app bundle is not allowed to be updated?
How does my app access the data?
In the simplest of cases, say I am delivering an xml or json file I guess most of the above would work like this: store the file in the documents directory, use filepaths in the app to access and load the data.
However what if it is something more complex that includes say images and other data that should be accessible just like other resources in the app bundle are accessible?
The crux of what is not clear to me is what type of data can be delivered, if it is anything I desire (which I presume it is) and I have complete control of the data type, where should this data content be stored and how can I enable my app to access this data as seamlessly as possible. For a concrete example suppose I am making a game, the first level is included in the app bundle, I deliver the second level via my own server, now, can I load that level the same way I load the one in the app bundle?
If there is a link or documentation I can pointed to that would be helpful but I have not found anything just yet, perhaps it is the concept of the app bundle that is most confusing because on a regular program I can do whatever I wish and things are not so unclear.