iOS 10 Toggle On/Off programmatically 3G/4G data with Private API - objective-c

So I got a client asking for a way to programmatically reset the data connection of his iPhone. The app won't go to the Appstore so any help is welcome.
There is two possibility but each one does involve Private API uses :
• Toggle 3G/4G On/Off
• Toggle AirPlane mode On/Off
The question is simple :
How to use the Private API to get the wanted result ?

With probability of 95% you won't be able to do that. Apple closed most of private APIs as of iOS 8.4. For education purposes, you could take a look at the iOS runtime headers for iOS 10.1 just to see what's no longer available.
Moreover, as of Xcode 7 you can't even link the private frameworks inside an app that easily - be it for AppStore or AdHoc.
So even if the client device is using a jailbreak, you won't be able to achieve it.
What you could do though - is write a jailbreak tweak and post it to Cydia, or somehow call an existing preinstalled tweak from inside your app on a jailbroken device - though I've never heard anyone do that.

Related

UWP access buttons

Helloo all
I'm currently developing an app for surface pro 3 that should be capable of:
detecting whether touchscreen was tapped and where
getting device information (product ID, amount of RAM, CPu model etc.) done by launching console application first which is capable of getting this information and saves it to a specific folder, UWP app can read its results from there and log them.
accessing sensor data like: accelerometer, gyroscope and ambient light sensor
testing cameras as i can command an app to make picture using either front or rear camera
testing microphones (both front and back)
testing speakers (i made synthesizer that is able to make beeps at given frequency at given stereo mode (left or right if both)
testing wifi - so it can connect to desired wifi network
bluetooth (swill working on it...)
I have already figured out quite a lot and put out a lot of work into it already, all listed tests are already developed on that UWP application so switching to completely different platform means rewriting whole app which I don't have time anymore.
UWP was chosen because this can run on different windows 10 devices and after completing this app the same app (with minor modifications) will be used on other windows 10 devices (like other surfaces and many different windows 10 phones)
This app will be automatically installed on a factory-resetted surface pro 3 that has no special configurations enabled, so tinkering with its settings is resource-hungry and not recommended process at all.
Now I have some other serious issues regarding of device:
how can I test the functionality of all the buttons Surface pro 3 has ?
It has 3 buttons: Volume up, Volume down and power button
but pressing power button sets screen to clack and locks device.
Can I make app override basic functionality of a button so that if button is pressed it detects it and logs its result.
same question goes to volume up and down buttons.
Only similiar questions about this are here:
Another thread on StackOverflow
I also cannot use same solution as I did with getting device information because test must be repetitive while app is running. (and UWP app cannot launch console application by itself)
Any help regarding this topic is highly welcome.
First for the power button behavior try this :
https://www.windowscentral.com/how-customize-power-button-action-when-pressed-windows-10
I don't have a surface so I cannot test it
also, I do have some inputs and thoughts about your app:
it seems to me that you are doing some sort of sanity check software for pieces of hardware I'd suggest looking into this
https://support.microsoft.com/en-my/help/4037239/surface-fix-common-surface-problems-using-surface-diagnostic-toolkit
https://www.lovemysurface.net/surface-diagnostic-toolkit/
additional thoughts of mine :
Overriding hardware behavior programmatically ould be considered as a harmful action especially when it comes to prebuilt devices such as the surface and by extension, I don't foresee MS providing API's for such a capability also such button might be communicating to the hardware directly rather and doesn't go through the software, runtime or the OS at all, changing it manually using the link i provided might be reflecting some registry settings changes but since UWP apps run in containers and cannot directly edit registry there is a dirty workaround look into this
read/write registery key file in uwp
hope this would help
You can use SystemInformation helper class from windows community toolkit it gives you a lot of details about the device.
https://learn.microsoft.com/en-us/windows/communitytoolkit/helpers/systeminformation

Can we change system setting like airplane state? [duplicate]

This question already has answers here:
Activate airplane mode programmatically?
(2 answers)
Closed 7 years ago.
Is there a magic trick to put iPhone on airplane mode ?
I saw this : http://blogs.oreilly.com/iphone/2009/01/bring-airplane-mode-control-ba.html
but it seems to be patched because I didn't managed to success with iOS 9.
You cannot do this with the Public APIs provided by apple.
This may be done using the unreleased Private APIs. But if you use these, you cannot publish your app on the store.
Every single App Store app is sandboxed with entitlements.
What you are trying to achieve is simply not possible if you want to distribute your app in the App Store. Your App simply cannot get enough privileges to achieve anything remotely similar. You cannot set global settings that changes the behaviour of the system. Apple will never allow that.
At the best you can monitor the status of the network connectivity via reachability but this is pretty much it. Using private API = straight app rejection.

Connecting to iMessage functionality with iOS8

I am making an iPhone app and need to be able to minimally see when a message comes in, when I myself look at it, and when I answer it. I need to see when this happens on the message app that is within the iPhone iOS. I have been looking around for a solution on this and have not been able to find one.
Is this possible to access this data on the iPhone or is it completely closed off?
There is no Messages SDK available currently (as of iOS 8.1) that would allow a developer to interact with (or receive) messages.
The most you can do is to share content through MFMessageComposeViewController.
Be aware other search results suggesting you can use CoreTelephony - you app will be rejected by Apple because CT is a private framework.

How to link to a specific preference pane in iOS 5

Background
The company I'm working in would like to launch an iOS app to support an hardware device that interacts with some mechanical automatism (aimed to home and building automation) we already produce.
Such automatism receives the pulse needed to activate itself from a nearby bluetooth device, whose MAC address is known by a white list.
We already know of the need to sign up to the MFi program for Bluetooth hardware to connect and talk effectively with Apple devices, exchanging significant messages, but what it is demanded here is to simply detect the presence of such MAC address. No need to establish protocol sessions and the like.
The facts
Investigating how to programmatically enable/disable Bluetooth interface in iOS, I learned it is impossible without private frameworks, as this post states; that is not an option for us, as the app has to be published on the App Store and it is known that Apple rejects apps including code that is coming from private frameworks.
By the way, the app usability would greatly benefit from a direct access to that feature, so I started thinking if, instead of directly interact with Bluetooth on/off state, would it be possible to let the user access to the Bluetooth preference pane straight from the application.
Does anyone know about that?
No, unfortunately it's not possible. There was a trick with:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
but it was opening only the preferences (not straight to bluetooth settings) and it's disabled in iOS 5.1. So your only chance is to make a really good help screen (with nice graphics and animations maybe) that explains the user how to enable the bluetooth.

Turn iPhone into a server programmatically?

I want to make my iPhone app display on a Mac's screen, kind of like AirPlay does with other machines. The only way I have heard to do this is, although I do not like it, turn the iPhone into a server. Unfortunately, I cannot figure out how to do so. I also wanted to set it up in such a way that my Mac automatically detects it. I have seen a similar setup in the game Chopper 2. My Mac app will have a simple timer that fires every few seconds to look for the iPhone, in the same way that Chopper 2's "Find iPhone" button does.
Is there a simple way to turn the iPhone into a server, or start a "session" like Game Center does?
One last thing: I know it is somehow possible, because another app I have actually gives my iPhone a web address at the click of a button. It is called the Dicenomicon, if you want proof.
First there is no easy way to redirect your display to Mac, even if you made it a server of some kind.
Second, to discover or publish customized services on WLAN, you may want to refer to the samples on Bonjour:
CocoaHTTPServer: a simple TCP/HTTP server.
WiTap: an app that discovers and connects to services of the same kind on WLAN by Bonjour.
I'm not really sure what you mean by "server", because there is no way to share the screen of an iPhone using the official SDK, although this is possible by jailbreaking.
It would be possible, however, to send data back and forth between the Mac and iPhone, and display the data on the iPhone, on a Mac. Using that data, you could try to recreate the interface on the Mac. All of this could be accomplished using sockets. A class that might help with that would be cocoaAsyncSocket, which makes network programming a lot easier.
The auto-discovery of iPhones on the local network is achievable with Bonjour. Without getting into too many details, NSNetService would allow you to publish a service for your app from an iPhone, and NSNetServiceBrowser would allow you to find that service on the local network from the Mac. From the NSNetServiceBrowser, you could establish a socket connection with the iPhone.
Good luck!
You might want to take a look at the GameKit APIs, I know they do something similar between two iOS devices.
http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/GameKit_Guide/Introduction/Introduction.html