How to switch networks(2G/3G/4G) WITHOUT jailbreak in iOS7?
I'd found some private APIs, but it looks like without the root access, I can only 'read', not 'write', which means that it doesn't work with the function
setAirplaneMode:YES
Is there any way to do this WITHOUT jailbreaking, and if so, how?
UPDATE
I found an Undocumented API, which can switch the network types(2G/3G/4G) without jailbreak in iOS7 and iOS8, even there are some little problems. Here it is:
char* sdk_path = "/System/Library/Frameworks/CoreTelephony.framework/CoreTelephony"; //path of this Undocumented API
int* handle = dlopen(sdk_path,RTLD_LAZY);
if(handle == NULL){
return;
}
struct CTServerConnection * (*CTServerConnectionCreate)() = dlsym(handle,"_CTServerConnectionCreate");
sc=CTServerConnectionCreate(kCFAllocatorDefault, callback, &t1);
void (*CTServerConnectionSetRATSelection)() = dlsym(handle, "_CTServerConnectionSetRATSelection");
Then, if you want to use the 2G only, you could use this function:
CTServerConnectionSetRATSelection(&t1, sc, kCTRegistrationRATSelection0);
for 3G only:
CTServerConnectionSetRATSelection(&t1, sc, kCTRegistrationRATSelection1);
but if you want to use 4G, you may need four parameters,
CTServerConnectionSetRATSelection(&t1, sc, kCTRegistrationRATSelection6,kCTRegistrationRATSelection6);
Oh, BTW, you should add these in your class:
extern CFStringRef kCTRegistrationRATSelection0;
extern CFStringRef kCTRegistrationRATSelection1;
extern CFStringRef kCTRegistrationRATSelection2;
extern CFStringRef kCTRegistrationRATSelection3;
extern CFStringRef kCTRegistrationRATSelection4;
extern CFStringRef kCTRegistrationRATSelection5;
extern CFStringRef kCTRegistrationRATSelection6;
extern CFStringRef kCTRegistrationRATSelection7;
extern CFStringRef kCTRegistrationRATSelectionUnknown;
I don't know how it works, but it does, in iOS7 and iOS8, without jailbreak. But here are the problems:
You cannot enable 3G/4G in your iPhone->settings if you have switch to 2G using this API. Looks like you force the system to use the network you have changed. And the other problem, We all know that in 4G, the voice call is using CSFB, but if you switch to 4G using this API, you cannot call any number or receive any incoming call, because the 2G and 3G is unable to use.
Does Anyone knows something about this function
_CTServerConnectionSetRATSelection ?
And, what does this
CFStringRef kCTRegistrationRATSelectionX
means? How could I solve my problem to enable calling in 4G? Thanks very much!
there is no public api for it. you're out of luck
I like dandan78's comment: I always ask the question: would it piss me off it an app was able to do X without my permission? If the answer is yes, then there's a very good chance Apple designed the system to prevent that from happening. And it would certainly annoy me if apps could mess with my connectivity."
链接地址: http://www.djcxy.com/p/58402.html