I know there are many questions: "How to open setting app programatically?" and the answer is "BIG NO". I know that Apple does not support opening Settings from any other app after iOS 5.0.
But there are some apps like MapMyFitness which can open Settings, and they are available in the App Store and have been approved by Apple. MapMyFitness opens the Bluetooth settings if Bluetooth is turned off. I have checked this in iOS 6 and iOS 5.1.
I want to know how can these apps are able to open Settings legally and bypassed Apple security because as per my information there is no legal way to do it?
Well, on iOS 5.0, there's the prefs://
URL scheme.
From iOS 5.1, that was removed. It's still possible to use private APIs and obfuscation to bypass the static analysis of the binary. Example:
void (*openApp)(CFStringRef, Boolean);
void *hndl = dlopen("/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices");
openApp = dlsym(hndl, "SBSLaunchApplicationWithIdentifier");
openApp(CFSTR("com.apple.Preferences"), FALSE);
By playing with the strings (splitting and concatenating them, etc.) you can eventually make it to the AppStore. It's still disallowed, though.