如何在 XCode 上创建移动 Substrate 插件?

发布于 2024-09-02 11:45:50 字数 1425 浏览 6 评论 0原文

我只是想创建一个 MS 插件来挂钩 SpringBoard。我正在关注这里的“gojohnnyboi”教程“ http://www.ipodtouchfans.com/forums/showthread.php?t=103558”。

要在 XCode 上创建 dylib,我遵循“SkylarEC教程。我混合了这两个很棒的教程,最终通过获得 dylib 获得了成功。但是当我将 dylib 放入 /Library/MobileSubstrate/DynamicLibraries/ 时,什么也没有发生(没有显示警报)。

通过评估,我发现,这个dylib在加载到内存时没有任何起点。因此,我通过在 .mm 文件中声明一个构造函数来提到一个起点,例如,

__ attribute__((constructor)) static void init()
{
    Class _$SBAppIcon = objc_getClass("SBApplicationIcon");
    MSHookMessage(_$SBAppIcon, @selector(launch), (IMP) &__$ExampleHook_AppIcon_Launch, "__OriginalMethodPrefix_");  
}

但是当我尝试编译它时,我收到一个错误,例如,

**Undefined symbols:
  "_MSHookMessage", referenced from:
      init()      in ExampleHook.o
ld: symbol(s) not found
collect2: ld returned 1 exit status.**

有人知道如何解决这个问题吗?如果有人分享在 XCode 上创建 dylib 的详细教程/说明,那就太好了,更有帮助。

PS我将所有libsubstrate.dylib和substrate.h文件放在相应的位置。位置是

  • libsubstrate.dylib : /Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/substrate.h
  • : /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include

我的基础 SDK 是 3.0。

I just wanna create a MS plugin to hook SpringBoard. I'm following "gojohnnyboi" tutorial from here "http://www.ipodtouchfans.com/forums/showthread.php?t=103558".

To create a dylib on XCode, I'm following "SkylarEC" tutorial. I mix these two great tutorials and finally got succeed by getting a dylib. But when I placed the dylib in the /Library/MobileSubstrate/DynamicLibraries/ nothing is happened (no alert was shown).

By evaluating, I found that, this dylib doesn't have any starting point when it was loaded into the memory. So I mentioned a starting point by declaring a constructor in the .mm file like,

__ attribute__((constructor)) static void init()
{
    Class _$SBAppIcon = objc_getClass("SBApplicationIcon");
    MSHookMessage(_$SBAppIcon, @selector(launch), (IMP) &__$ExampleHook_AppIcon_Launch, "__OriginalMethodPrefix_");  
}

But when I'm trying to compile this, I'm getting an error like,

**Undefined symbols:
  "_MSHookMessage", referenced from:
      init()      in ExampleHook.o
ld: symbol(s) not found
collect2: ld returned 1 exit status.**

Does anyone has idea how to solve this? It would be great and more helpful if anyone share the detailed tutorial/instructions to create a dylib on XCode.

P.S I placed all the libsubstrate.dylib and substrate.h files in the corresponding location. And the locations are,

  • libsubstrate.dylib : /Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/
  • substrate.h : /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include

and my base SDK is 3.0.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

吝吻 2024-09-09 11:45:50

您可能应该查看 iOSOpenDev

You should probably check out iOSOpenDev

韵柒 2024-09-09 11:45:50

(这些都是非常古老的教程。一些现代的 MS 代码可以在 http://iphonedevwiki.net/index 中找到.php/MobileSubstrate。最终有人需要编写更新的教程...)


确保您已在 Xcode 项目中添加了 libsubstrate.dylib(添加 → 现有文件...)。除非您指定,否则编译器不会自动查找要链接的 dylib。

(These are very old tutorials. Some modern MS code can be found in http://iphonedevwiki.net/index.php/MobileSubstrate. Eventually someone needs to write an updated tutorial...)


Make sure you have added libsubstrate.dylib in your Xcode project (Add → Existing files...). The compiler will not automatically find which dylib to link unless you tell it so.

把回忆走一遍 2024-09-09 11:45:50

尝试 http://unlimapps.com/?p=15 使用它来编译插件会更容易那个帖子里的方法

Try http://unlimapps.com/?p=15 it will be much easier to compile plugins using the methods in that post

孤凫 2024-09-09 11:45:50

您必须将 CydiaSubstrate.framework 复制到 Mac 中的 /Library/Frameworks 并链接到 CydiaSubstrate

#include <CydiaSubstrate/CydiaSubstrate.h>

You have to copy CydiaSubstrate.framework to /Library/Frameworks in your mac and link to CydiaSubstrate

#include <CydiaSubstrate/CydiaSubstrate.h>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文