How to detect if user has turned off mobile data for specific iOS App - ios

I've come across a scenario where I need to know if the user has turned off mobile data for the app I'm developing so I can display a warning saying: "You have turned off mobile data, data will be synced when you connect to wifi". I wanted to be clear that I only need the information about my own app, not others the user has installed.
The problem is, i only have a narrow lead on where to start. I've come across a post saying this is possible, but not how. The answer talks about a "telephony class" which will enable some way of accessing the data about the settings for mobile data of your app. I'm guessing this is a native iOS class.
Link to the article on SO can be found here - link to post
My question is, which class, if there even is one in swift, has such an api, that I can get this information?
I'm new in swift and therefore know little of native classes and permissions.
I can provide more information if needed. This was all I could think of.
PS. I'm not looking for the Reachability class where I can detect WWAN / WIFI connection, unless this has some capabilities I'm not aware of.
Kind regards Chris

Related

iOS - Retrieve the most visited websites on the device

I am developing a mobile app in objective-c for iOS.
Is there a way inside my app to programmatically retrieve the most visited websites from the browsers on the device?
I am interested in the urls specifically (e.g. "http://www.google.com"), in order to check a couple of things.
I've searched online but I haven't find anything that could satisfy these needs: does every browser save this kind of information in a private folder not accessible to anyone else and so it's not possible to get this data? Or am I missing something else?
Thanks anyway for your answers
The answer is: No, it's impossible. Apple doesn't give as an API to do that.
No, the developed applications are sandboxed. You can't access data out of one app from another. It's part of the security model.
Apple didn't published APIs for this privacy access level, It only published the following APIs for Safari extensions:
https://developer.apple.com/documentation/safariservices/safari_app_extensions
BTW, This question is asked alot before, you can check them:
how to programmatically access iphone browser history
How to access iPhone Safari History in an App?

Apple keeps rejecting app with AdMob because of bluetooth notification string not correct

Since IOS 13 came to live old 3 party APIs stopped working, In my app i needed to fix few because of that so i needed to fit it to IOS 13.
Since then Apple keeps rejecting my app because of Bluetooth user notification is not correct.
I just don't know what to write there, It is so annoying. I have to add it because of AdMobs and there is nowhere to say what to write over there.
I don't user BT in my app, it is just the AdMobs beacons that needs it probably.
I've tried:
and
And i will probably will have the same issue with the calendar message also.
When i try to remove it they demand it and then not approving it.... I understand maybe the first one but what wrong with the the second one? why is that no clear enough for them?
10x
see apple docs below: https://developer.apple.com/design/human-interface-guidelines/ios/app-architecture/requesting-permission/
Explain why your app needs the information. Provide custom text (known
as a purpose string or usage description string) for display in the
system's permission request alert, and include an example. Keep the
text short and specific, use sentence case, and be polite so people
don't feel pressured. There’s no need to include your app name—the
system already identifies your app. For developer guidance, see
Protecting the User's Privacy.
you're not explaining exactly why you need access to bluetooth. you must be specific. saying, "XYZ app needs access to bluetooth to interact with beacons to serve you location based advertisements"
something like that should do. no cutting corners, no trying to put it off on Google, just say it like it is and you'll likely pass through app approval without a problem.

How to get all app list and data usage of that app in swift?

Request:Please do not mark it as duplicate because i gone through many questions.
I want to create app in which i want all app from my iPhone / iPad with its data usage. I get an idea for that i need VPN but i don't know how to implement it in app. I gone through many question and answer but i don't get satisfied answer. So how could i achieve this problems solution?
i gone through this question but i am not fully satisfied
You can't get list of all apps installed on your iPhone/iPad, if device is not jailbreaked.
In question your mentioned VPN was used to get info about apps that used network connection.
However event if you will implement it, you will not be able to see apps that not use network

App rejected due to an IPV6 Swift3 error. How do I fix it?

A few days ago, Apple rejected my app, indicating that it didn't have IPV6 support, however I don't need that support since my app does not require internet access.
I asked the following:
Hi, my app does not need any internet connection yet.
So, why it's required to have support to IPV6?
They said:
Thank you for your response and for your question. In order to bring your app into compliance with Guideline 2.1 it would be appropriate for your app not to crash when logging in.
end
So, why do I need that Support?
If is necessarily, how do I can do it?
Please I need help
Test your app extensively and fix the crash. Enter wrong values, don't enter anything at all, intentionally try to break your app and get it to crash. Then you will find your error and you can fix.
EDIT BASED ON COMMENT BELOW
"My app don`t need conect with external database, because I got the information inside" - in this case, no, you do not need to add IPv6 support because you are not communicating with the internet for logging in purposes.
You can keep the login given it is only going to be 2 people using the app, just resolve the crash when logging in.
To test, enter a variety of incorrect passwords and usernames to ensure that there is no crash on incorrect entries, and confirm that correct entries do not crash the app.
Original Answer
Apple indicated that because there is a login feature, they think it is trying to communicate with an external database (ie a database that is not on the device). If there is no external database, just fix the crash is what they are asking.
Based on your question, you have eluded to the app not communicating externally for logging in. While some may find this odd, it is not uncommon. An example for those wondering would be a childrens app for iPad. The iPad might be shared amongst several children and as such each child might complete different sections or features of the app so an account local to the device is a good idea if there is no cloud support.
If there is external communication, you need to handle the case for no internet access. The question has been answered extensively, however this was the first result I found:
Detect Internet Connection and display UIAlertview Swift 3
Update: Why do I need to Support the case for no internet connection?
A use case:
John has just downloaded your app. He has just walked through the steps to create an account, but he has accidentally set his device to Aeroplane Mode.
John hits the "Create Now" button but nothing is happening. There is no error or success alert appearing, the screen has not changed, he can't see a loading icon. John is confused and getting frustrated because he's certain that he has completed everything in the form.
John doesn't understand that he needs internet connectivity to successfully submit a request to create an account. John decides to delete your app from his device and leaves a bad review.
John really could have used an alert saying "You need internet connection to sign up to this app. Please check you are connected and try again". This would have made John a whole lot happier and he probably would have continued to use your app with all of it's amazing features.
More information can be found in the guidelines that Apple mentioned, and further to this, the Apple Design Principles Guide is an invaluable resource.
I hope this makes sense.

options on how to read external data into my ios app

ive begun writing an ipad app which will use mapkit to show nearby locations of people offering things for sale ie like property (houses, units etc). i know an individual user can store their own information, data, photos etc on their own device and im intending to incorporate coredata to allow this. What i dont understand are the technologies needed to get "other user's" info, data, property photos etc showing on an individual users device. from my limited knowledge i assume i would need some type of server technology and then send all the information from all current nearby users to each individual user's device so each user can see all the "offerings" of nearby users. what i dont understand is if apple (or anyone else) has provided some frameworks which i can piggy back on to achieve this or whether i'm on my own re learning and developing this. any assistance on best way to start this task is appreciated
You can use Parse as your backend service . It is free at some point.

Resources