I am working on a lockscreen tweak. In my custom lockscreen view, there is a button which yo can use it to lock and open the native phone app. The IDE I'm using is iOSOpenDev.
I had tried those methods:
Url scheme:i do not want the dial display, so abandoned.
SBSLaunchApplicationWithIdentifier. It is the most popular method,like this:
void* sbServices = dlopen("/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices", RTLD_LAZY);
int (*SBSLaunchApplicationWithIdentifier)(CFStringRef identifier, Boolean suspended) =
dlsym(sbServices, "SBSLaunchApplicationWithIdentifier");
int result = SBSLaunchApplicationWithIdentifier((CFStringRef)bundleId, false);
dlclose(sbServices);
but in the .xm file, the compiler tells me
Cannot initialize a variable of type 'int (*)(CFStringRef, Boolean)' with an rvalue of type 'void *'".
How can i do this? thanks!
I'm not sure which compiler you're using that gives you this error ... the Apple LLVM Compiler (4.2 or 5.0) accepts the code you've shown, with no problems.
But, I think, you should just be able to fix that compile error by casting the return value of dlsym()
to a (int (*)(CFStringRef, Boolean))
:
int (*SBSLaunchApplicationWithIdentifier)(CFStringRef identifier, Boolean suspended) =
(int (*)(CFStringRef, Boolean))dlsym(sbServices, "SBSLaunchApplicationWithIdentifier");