iOS 6.x在越狱中打开命令行 [英] iOS 6.x open command line on jailbreak
问题描述
在iOS 6.x之前,我使用打开package_id
在iOS设备上从命令行打开应用程序。
在iOS 6.x如果我使用这个命令SpringBoard崩溃。
打开$>是否有替代方法或修复程序
b $ b > 看起来像原来的
/ usr / bin / open
已更新为iOS 6在Cydia上,所以我建议你先试试。 原始答案:
我想打开打开
,太!但是,直到它为iOS 6更新,你可以只是构建自己的非图形应用程序(只是一个主
程序,而不是一个 UIApplicationMain()
我将跳过从解析命令行参数int main(int argc,char * argv []
,但一旦你知道你想要的应用程序的 Bundle Id ( CFBundleIdentifier
打开 SpringBoardServices 私有框架,并使用它来启动应用程序:
#include < dlfcn.h>
#define SBSERVPATH/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices
- (void)openApp:(NSString *)bundleId {
// SpringboardServices.framework私有框架可以启动应用程序,
//所以我们动态打开它,并找到SBSLaunchApplicationWithIdentifier()
void * sbServices = dlopen(SBSERVPATH,RTLD_LAZY);
int(* SBSLaunchApplicationWithIdentifier)(CFStringRef identifier,Boolean suspended)= dlsym(sbServices,SBSLaunchApplicationWithIdentifier);
int result = SBSLaunchApplicationWithIdentifier((__ bridge CFStringRef)bundleId,false);
dlclose(sbServices);
}
此代码需要 com.apple.springboard。 launchapplications
授权为您的命令行程序使用它成功,作为 mobile
用户。 请参阅此处以添加权利。您需要一个可执行文件的entitlements.xml文件,例如:
< DOCTYPE plist PUBLIC - // Apple // DTD PLIST 1.0 // ENhttp://www.apple.com/DTDs/PropertyList-1.0.dtd\">
< plist version =1.0>
< dict>
< key> com.apple.springboard.launchapplications< / key>
< true />
< / dict>
< / plist>
然后使用
签署 ldid -Sentitlements.xml MyCommandLineTool
strong>我尚未测试此功能,但此答案声明,使用授权的替代方法是以root用户身份运行命令 。
Before iOS 6.x, I used open package_id
to open a app from command line on a iOS device.
On iOS 6.x if i use this command SpringBoard crashes.
Open is available from BigBoss and the author is Conrad Kramer.
Is there an alternative or a fix for the open
command from BigBoss?
Update:
It looks like the original /usr/bin/open
has been updated for iOS 6 on Cydia, so I recommend you try that first.
Original Answer:
I miss open
, too! But, until it gets updated for iOS 6, you can just build your own non-graphical app (just a main
program, not a UIApplicationMain()
) and do the same thing yourself.
I'll skip over parsing command line arguments from int main(int argc, char *argv[]
, but once you know the Bundle Id (CFBundleIdentifier
) of the app you want to open, open the SpringBoardServices private framework, and use it to launch the app:
#include <dlfcn.h>
#define SBSERVPATH "/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices"
-(void) openApp: (NSString*) bundleId {
// the SpringboardServices.framework private framework can launch apps,
// so we open it dynamically and find SBSLaunchApplicationWithIdentifier()
void* sbServices = dlopen(SBSERVPATH, RTLD_LAZY);
int (*SBSLaunchApplicationWithIdentifier)(CFStringRef identifier, Boolean suspended) = dlsym(sbServices, "SBSLaunchApplicationWithIdentifier");
int result = SBSLaunchApplicationWithIdentifier((__bridge CFStringRef)bundleId, false);
dlclose(sbServices);
}
This code requires the com.apple.springboard.launchapplications
entitlement for your command line program to use it successfully, as the mobile
user. See here for adding an entitlement. You'd need an entitlements.xml file for your executable, like this:
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.springboard.launchapplications</key>
<true/>
</dict>
</plist>
And then sign it with
ldid -Sentitlements.xml MyCommandLineTool
Note: I haven't tested this, but this answer states that an alternative to using entitlements is to run the command as root.
这篇关于iOS 6.x在越狱中打开命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!