Can you connect to system function calls in iOS using private APIs?

Is it possible to connect to system function calls in iOS using private APIs on a device without jailbroken ? From what I saw, this is doable on jailbroken devices using MobileSubstrate MSHook.

What I would like to do is an application that will intercept a system call when switching the device’s orientation lock in the Control Center ( http://i.stack.imgur.com/NfbGw.png ) and call CTRegistrationSetCellularDataIsEnabledto switch the use of cellular data .

So far, I have managed to create an iOS 8 Notification Center widget that does just that, but would it be nice to have a way to switch 3G from the Control Center?

Obviously, the application is for my personal use only.

+4
source share
2 answers

From the point of view of accomplishing this task, the way you describe it ... no , I don’t think there is a way to do this without jailbreaking.

You can use the swizzling method to connect iOS methods in non-jailbreak apps for personal use. But this limits the ability to connect code called from your application. In other words, if your application moves to the iOS infrastructure, you can push methods this way.

SpringBoard . (Cydia Substrate) , , . .

Interposition API- C, .

CTRegistrationSetCellularDataIsEnabled, , , . , , CoreTelephony.framework, API. (. , )

, , , , , .

.. , iOS - Darwin, , - , ... , .

+3

, .

void *ctPath = dlopen("/System/Library/PrivateFrameworks/CoreTelephony.framework/CoreTelephony", RTLD_LAZY);
void (*CTRegistrationSetCellularDataIsEnabled)(BOOL) = dlsym(ctPath, "CTRegistrationSetCellularDataIsEnabled");
if (CTRegistrationSetCellularDataIsEnabled) {
    CTRegistrationSetCellularDataIsEnabled(YES);
}
0

All Articles