iOS11 check or change an app's storage location setting - ios

I have recently discovered that an app that I am developing can run into issues if users have chosen that they want the apps storage location to be set to anything different from "Local Storage".
It seems that iOS11 allows any app that uses documents to change the Document Storage placement to any place, even if the app internally does not support iCloud storage, as a result I am getting bad reviews from frustrated users that are changing the default setting to iCloud (or some other cloud vendor) and then realizing that it does not work.
I would like to stop them from changing this setting as in my case it does not make any sense (you don't want to be constantly storing caches of temporary files on the cloud) but I can't seem to find a way to change this (it's an Apple Settings app thing) or at least check the value so I can inform about it's current setting.
Showing a message for all users regardless of what their setting is seems like an extreme solution, so I'd like to know if anyone has managed to find a way to either query the value or change it, any will do for me.

Related

Storing a text file in iCloud in Xamarin

I need some clarification and Microsoft documentation is only confusing me more.
I want to save a txt file in iCloud so the user doesn't loose some data that belongs to them.
This db document is some information I am retrieving from a local database and storing in a text file. I have seen two ways of doing this.. however all the posts on this topic are very outdated and I don't know which way might be best or if they are even doing what I trying to do.
All I would like is to be able to have the user backup this particular file to their iCloud account, so they can still keep this info even if they change phones or delete the app and want to restore from iCloud.
Microsoft's documentation points me to this page https://learn.microsoft.com/en-us/xamarin/ios/data-cloud/introduction-to-icloud
I began setting up the provisioning profiles and setting the iCloud options on the entitlements page etc. However the documentation when sideways for me when they began creating a monkey page UI Document and having the user manager the ubiquity documents (which I don't want) I actually don't want the user even seeing this Txt file. However this option shows how to check if the iCloud is even turned on on this user's phone.
Now this other option I think is more straight forward and I read the documentation on it here https://learn.microsoft.com/en-us/xamarin/ios/app-fundamentals/file-system using something like this to store and retrieve a document:
var libraryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "..", "Library");
However what if iCloud is turned off? Is this an automatic backup option?
Any type of explanation is helpful.
The iCloud storage API in iOS 5 allows applications to save user documents and application-specific data to a central location and access those items from all the user's devices.
About the definition of iCloud, you will know that it will save your data to cloud server. And it can be used in all the user's device if turn on the iCloud.
However what if iCloud is turned off?Is this an automatic backup option?
Therefore, if iCloud is turned off, you could backup the data in device although it will not be used for other user's devices. You could save it in Application directories. This should be a good chooice to backup your data. And you also can get the data when you need them.
In addition, you also can use other cloud server APIs to backup your data. Such as Azure Storage, Firebase Storage etc.

Accessing previously created folder with oauth Google Drive

We are building an app that allows users to connect their cloud storage (in this case gDrive) and upload files from our app, however they also have the ability to disconnect from it and perhaps connect to another.
A use-case might be:
A User connects to gDrive(App creates folder and uploads files) >
Later user disconnects from drive in-app >
Later user reconnects
Problem being we then want to grab this previously created folder and make changes and the issue is, in order for the user to reconnect they have to reauthorize, setting a new token and we therefore no longer have access to that folder and instead our app auto-creates a new folder with the same name - obviously this is not what we want.
The only solutions we can think of is not re-authorizing on disconnect/connect or increasing the scope of oauth and searching for the folder.
We will be using something like rClone in the future, but for now we are focusing on a couple of the main cloud services.
Are there any other solutions to this?
Your app is using drive.file scope, which allows it to access files created or opened by the app.
Users commonly disconnect from the app, effectively deauthorizing it. Because of this, the app does not have access to folders that were created last time user connected to the app.
The description of drive.file scope is quite clear:
Per-file access to files created or opened by the app. File authorization is granted on a per-user basis and is revoked when the user deauthorizes the app.
Because of this, unfortunately, the only two ways to allow the app to access previously created folders are the ones you already sketched:
Use a scope that provides a wider access: the scope in this case should probably be https://www.googleapis.com/auth/drive, since the app, from what I understand, needs write access.
Change the workflow of your app so that users don't deauthorize the app.
Regarding the use of a wider scope, the following feature request, which apparently was internalized recently, could provide an acceptable workaround in case it got implemented:
FR: Drive Restrict access to folder when authorizing applications
I'd suggest you to star the referenced issue, to keep track of its development and to help prioritizing it.

Is there a way to mark files in iOS so they are not purged from Library/Caches directory in low storage situation

We have an app developed with a Newsstand kit, so files are stored inside of Library/Caches and we can't change the location because of the use of Newsstand. And we want those files not to get purged in low storage situation. So we mark all of them with "do not back up" attribute according to iOS Data Storage Guidelines:
https://developer.apple.com/icloud/documentation/data-storage/index.html
"4. Use the "do not back up" attribute for specifying files that should remain on device, even in low storage situations."
But unfortunately all of them get purged anyway (we tested it in iOS 11.3-12.0). Can we, please, use some other methods to disable purging?
Any other ideas to make it work.
Thank you!
Unfortunately, you can't stop all your back issues from being purged in a low storage situation.
Newsstand Kit allows you to specify the issue that the user is currently reading, by setting the currentlyReadingIssue property of NKLibrary.
According to the docs: "Newsstand Kit takes this setting into consideration when it purges back issues because of low levels of available flash storage."
https://developer.apple.com/documentation/newsstandkit/nklibrary/1615812-currentlyreadingissue?language=objc
There's no way to force NewsstandKit to keep all back issues in a low storage situation.
See the Newsstand FAQ, in particular "Will all of my issues be automatically stored on the user's device, indefinitely?":
https://developer.apple.com/library/archive/technotes/tn2280/_index.html#//apple_ref/doc/uid/DTS40011215-CH1-MANAGING_CONTENT-CAN_I_MOVE_MY_ISSUES_OUT_OF_THE_DEFAULT_NEWSSTAND_STORAGE_LOCATION_ONCE_THEY_RE_DOWNLOADED__OR_DOWNLOAD_ISSUES_TO_ANOTHER_LOCATION_
"Newsstand Kit provides a managed repository for your issues located
at the contentURL for the NKIssue. This managed repository acts as a
cache for the content you host on your servers, and like any cache is
susceptible to eviction as system resources become low.
In such an event, the information you provide Newsstand Kit via the
currentlyReadingIssue property and the date parameter in
addIssueWithName:date: helps Newsstand Kit to prioritize which content
is most critical for the user as it evicts elements from the cache.
Your Newsstand app should be capable of re-downloading back issues at
the user's request, should such resource constraints arise."
Newsstand Kit prioritizes which issues it keeps in a low storage situation and, unfortunately, you can't have any influence over that outside of keeping the currentlyReadingIssue property up-to-date.

Difference in security of a jailbroken iphone

just to be more specific, I would like to know more about the system files that can be accessed with regards to a jailbroken phone.
From what I understand, each ios application has its own sandbox. A phone has root access once it is jailbroken, allowing creation of 3rd party system applications which result in accessing the system files. However, if I am not wrong, the sandbox is still there just that it has lesser restrictions hence allowing accessing of system files?(not sure about this part too).
So for a jailbroken phone, what kind of critical system files are we able to access from our created application that will go through the sandbox and which are not accessible from a unjailbroken phone? Is contact list a part of the critical system files, although I believe we are still able to get contact list without a jailbroken phone using the Address Book frameworks.
I may be wrong, but my term of Critical system files refers to system information that normal users would not like others to get hold of so I was thinking if contact list is part of it even though it does not require a jailbroken phone.
Without taking Tweaks into consideration, an app is able to read/write/execute in the root directory /. Tweaks are able to do whatever they want (just like the app would - even an Apple pre-installed app), depending on where they are hook-ing. For example, a tweak I was working on for MobileSMS (the SMS app) can give me the passcode of your iCloud account stored in the keychain by default.
Long story short, jailbreaks equals zero security for an average user. On the other hand, there is only one exploit (at least to my knowledge) currently, that attacked iOS and came from GeorgiaTech a few months ago, hidden in an app on the App Store.

Reading Files belonging to other Apps iOS

I am currently coding a backup app for iOS, and I want to have options to let the user back up things like Application Data (other app's documents, etc,) Contacts, Safari Bookmarks, and all that fun stuff.
I'd like to know if that's possible, how I'd do it, and where those files are stored, and most importantly, if this is actually allowed by Apple. I read through their docs, and I haven't seen anything that speaks against it.
It's not possible. Your app isn't even capable of reading the documents from other apps. This is accomplished via sandboxing. Every read/write your application tries to do to the filesystem is checked by the kernel to ensure you're staying within your sandbox. The documents belonging to other apps are outside of your sandbox, so you cannot see them.
They aren't allowed. All iOS apps are sandboxed, and can't access other apps' data.
Your app, naturally is in a sandbox, which does not allow you to read outside of the app. If you jailbreak your device, then yes, it is possible.

Resources