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

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

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?

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

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

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.

Can I connect single MFI accessory with two apps at a time

I have two apps with same UISupportedExternalAccessoryProtocols. These are communicating with the MFI certified device. How I can know that the session is already created with other app on the same device. So I can alert to the user that you can't create multiple sessions with the same accessory at a time.
Please help to fix this.
Thanks in advance.
I personally consider AyBayBay's answer invalid, since you tagged your question with the "iOS tag" and NSDistributedNotificationCenter is not supported on this platform. (There is a low level api to do this, but I think it's in a private framework)
If you are pretending to target your app to iOS8+, the simplest way to do it is using iOS8's AppExtensions feature. I made some tests creating a session within my app, and sending info to the device from another app using extensions the way below.
some app -> app extension -> my app connected with ext.device -> ext.device
so I'm pretty sure you can check if the session is opened or not and return this info to the caller app.
FYI: To pass info to another app you can also use URLSchemes or UIPasteboard too, but both behaviours in a different way than AppExtensions and I think it not fits on your case. Maybe it helps someone else...
Well when one app connects and establishes a session with your MFI device, you can post a notification to NSDistributedNotificationCenter. Your other app can subscribe and listen for this message, upon recieving it and processing it in its runLoop (when it comes back into the foreground) you can have code that blocks it off from creating a session at the same time. You will have to experiment with this a bit but it can be done.

iOS - Can an app running in the background send touch / gesture events to another app in the foreground?

I have been asked to develop an app that will record and later "play back" touches and gestures onto another app running in the foreground.
From my experience and knowledge, this is not possible unless both apps are setup to send/receive data between them through notifications or other methods. Also, it would be a huge risk for apps and their data to be exposed to anybody.
I am 99% sure this is not possible, but was just curious if anyone else has come across something similar (or documentation that specifically states this is forbidden).
Nope not possible, no way no how, dont even try.
Expanded answer, if this runs on a jailbroken phone.......
Yes.... but good luck,
check Saurik's Veency code for this sort of functionality, it would have to be refactored signifcantly but basically it allows for virtualization of taps.
https://github.com/iceNuts/TouchTest
http://gitweb.saurik.com/veency.git
if you want to access another application in your iPhone ,you can set the url scheme parameter and so on.You can add callback in your url,then you can return back your application.
It's actually possible with facebook's idb:
https://github.com/facebook/idb/
As it stated:
Remote Automation. idb has a “companion” that runs on macOS and a python client and cli that runs anywhere. This enables scenarios such as a “Device Lab” within a Data Center or fanning out commands to large numbers of iOS Simulators.
As facebook stop support on WebDriverAgent, it's the best option we have right now

Resources