我想为 iPhone 实现锁屏调整。在锁屏上,我添加了一个可以解锁屏幕和打开手机应用程序的按钮。这个按钮动作的代码是:
[self unlockWithSound:YES];
int (*openApp)(CFStringRef, Boolean);
void* sbServices = dlopen("/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices", RTLD_LAZY);
openApp= (int(*)(CFStringRef, Boolean))dlsym(sbServices,"SBSLaunchApplicationWithIdentifier");
openApp(CFSTR("com.apple.mobilephone"), FALSE);
dlclose(sbServices);
但是当我点击此按钮执行此代码时,iOS 会在几秒钟内崩溃并重新启动。我的 iPhone 运行的是 iOS 6,经常越狱。
当我在后台线程中执行代码时,我在 syslog 文件中看到了这一点:
Entitlement com.apple.springboard.launchapplications required to use kern_return_t _SBXXLaunchApplication(mach_port_t, char *, sbs_url_string_t, sbs_property_list_data_t, mach_msg_type_number_t, sbs_property_list_data_t, mach_msg_type_number_t, SBSApplicationLaunchFlags, SBSApplicationLaunchError *, audit_token_t)
在主线程中:
Oct 31 11:11:40 Kevin-Yes-iPhone lockdownd[41]: 2fe93000 _receive_message: walk away - non-SSL 1
Oct 31 11:12:13 Kevin-Yes-iPhone profiled[163]: (Note ) profiled: Idled.
Oct 31 11:12:13 Kevin-Yes-iPhone profiled[163]: (Note ) profiled: Service stopping.
Oct 31 11:12:15 Kevin-Yes-iPhone securityd[363]: MS:Notice: Installing: (null) [securityd] (793.00)
Oct 31 11:12:15 Kevin-Yes-iPhone afcd[367]: Max open files: 125
Oct 31 11:12:17 Kevin-Yes-iPhone afcd[368]: Max open files: 125
Oct 31 11:12:33 Kevin-Yes-iPhone securityd[369]: MS:Notice: Installing: (null) [securityd] (793.00)
Oct 31 11:12:37 Kevin-Yes-iPhone lockdownd[41]: 2fe93000 _receive_message: walk away - non-SSL 1
Oct 31 11:13:00 Kevin-Yes-iPhone securityd[371]: MS:Notice: Installing: (null) [securityd] (793.00)
我的问题是:为什么我的调整不能执行这段代码?我使用 iosopendev 作为我的开发工具,是 iosopendev 的问题吗?