昨天看到狗剩在获得iDevice中获得已安装的使用了私有库,采用如下的加载方式,objc_getClass(“LSApplicationWorkspace”)来获得类及其实例,今天我想试着用下其他的私有库,却不行了。下面是我的尝试。
我想加载这个库,PrivateFrameworks/FrontBoard.framework/FrontBoard,
于是我用find 去搜索了机器里面的文件,得到以下几个路径包含有这个库,如下:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/PrivateFrameworks/FrontBoard.framework
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/FrontBoard.framework
/Users/username/Library/Developer/Xcode/iOS DeviceSupport/8.0 (12A365)/Symbols/System/Library/PrivateFrameworks/FrontBoard.framework
/Users/username/Library/Developer/Xcode/iOS DeviceSupport/8.0.2 (12A405)/Symbols/System/Library/PrivateFrameworks/FrontBoard.framework
拿到这路径以后用第一条记录里面的文件尝试去使用里面类,FBProcessManager,采用objc_getClass(“FBProcessManager”)但是没有成功,拿到的是NULL返回;
接着又尝试了采用静态库加载的方式,如下:
#define FrontBoard_PATH “/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/PrivateFrameworks/FrontBoard.framework/FrontBoard”
采用dlopen去动态加载,还是失败了;
接着又尝试了第三条记录,分别试了没有转义的路径跟转义后的路径,都没有成功的加载到这个类,不知道是哪儿的步骤错了,希望大家指点。
目的就是成功加载到FBProcessManager类就行了。