我想从任意包标识符创建一个包,
例如com.apple.iokit.IOStorageFamily
这不是不合理的事情,因为捆绑 ID 应该
是唯一的,但是明显的代码不起作用:
NSString* bID = @"com.apple.iokit.IOStorageFamily";
NSBundle* bundle = [NSBundle bundleWithIdentifier:bID];
这段代码只适用于你已经加载的包
(你好,鸡和蛋的问题),事实上,在你做任何事情之前,你必须
比你想知道的标识符多
一点。对于上面的 ID 样式,
我 grep 出最终组件并将其转换为
/System/Library/Extensions/IOStorageFamily.kext
然后通过路径加载。
这是最先进的技术还是有更通用的方法?