iOSOpenDev的_MSHookMessageEx,已经替换libsubstrate.dylib

iOSOpendev已经成功安装好了 新建了个简单的项目来进行测试报下面这个错误,我看了论坛上的帖子 都说是没替换libsubstrate.dylib,我已经替换了/opt/iOSOpenDev/lib/libsubstrate.dylib
从手机里复制出来改名字 并且替换的,

Ld /Users/Rick/Library/Developer/Xcode/DerivedData/DMWeChatPlugin-eefeiomqzgiwfuaiijyfzflbgptq/Build/Intermediates/DMWeChatPlugin.build/Release-iphoneos/DMWeChatPlugin.build/Objects-normal/arm64/DMWeChatPlugin.dylib normal arm64
    cd /Users/Rick/Documents/Demo/DMWeChatPlugin
    export IPHONEOS_DEPLOYMENT_TARGET=9.3
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch arm64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk -L/Users/Rick/Library/Developer/Xcode/DerivedData/DMWeChatPlugin-eefeiomqzgiwfuaiijyfzflbgptq/Build/Products/Release-iphoneos -L/opt/iOSOpenDev/lib -F/Users/Rick/Library/Developer/Xcode/DerivedData/DMWeChatPlugin-eefeiomqzgiwfuaiijyfzflbgptq/Build/Products/Release-iphoneos -F/opt/iOSOpenDev/frameworks -F/Users/Rick/Documents/Demo/DMWeChatPlugin/DMWeChatPlugin -filelist /Users/Rick/Library/Developer/Xcode/DerivedData/DMWeChatPlugin-eefeiomqzgiwfuaiijyfzflbgptq/Build/Intermediates/DMWeChatPlugin.build/Release-iphoneos/DMWeChatPlugin.build/Objects-normal/arm64/DMWeChatPlugin.LinkFileList -install_name /Library/MobileSubstrate/DynamicLibraries/DMWeChatPlugin.dylib -miphoneos-version-min=9.3 -dead_strip -fembed-bitcode-marker -fobjc-link-runtime -framework UIKit -framework Foundation -single_module -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/Rick/Library/Developer/Xcode/DerivedData/DMWeChatPlugin-eefeiomqzgiwfuaiijyfzflbgptq/Build/Intermediates/DMWeChatPlugin.build/Release-iphoneos/DMWeChatPlugin.build/Objects-normal/arm64/DMWeChatPlugin_dependency_info.dat -o /Users/Rick/Library/Developer/Xcode/DerivedData/DMWeChatPlugin-eefeiomqzgiwfuaiijyfzflbgptq/Build/Intermediates/DMWeChatPlugin.build/Release-iphoneos/DMWeChatPlugin.build/Objects-normal/arm64/DMWeChatPlugin.dylib

Undefined symbols for architecture arm64:
  "_MSHookMessageEx", referenced from:
      _logosLocalInit() in DMWeChatPlugin.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

tweak里面就这么多代码

#import <UIKit/UIKit.h>
%hook AppDelegate
- (BOOL)application:(id)arg1 didFinishLaunchingWithOptions:(id)arg2{
    BOOL supBool = %orig(arg1,arg2);
    NSLog(@"=======测试一下=====");
    return supBool;
}
%end

我测试了下 如果tweak里面只有下面一句

#import <substrate.h>

编译可以通过。。。
/opt/theos/lib/libsubstrate.dylib 也替换了
真不知道哪里还有问题了

#import <substrate.h>
代码里加上这一句看看?

试过了,加上#import <substrate.h>后 编译依旧不通过

以前遇到过,发现是编译的目标忘记选为设备手机了

1 个赞

建议还是强迫自己学下theos和Markfile语法吧

会发现好处多多

你好,我遇到和你一样的问题,请问你搞好了吗?

今天我新建了一个application modern的工程 调用hook的函数就报linker错误 感觉就是库没有被导入 但是不知道该从makefile文件里去如何修改 还请指点一下迷津

image

你好,我现在也遇到一样的问题了,请问你ok了不?

你好,我也遇到一样的问题了,请问你解决了吗 最后

你好,请问你这个问题解决了吗

这个问题太久远了 建议使用iOSOpenDev AlonMonkey的MonkeyDev 纯THEOS的makefile 及相关库的配置的确 是麻烦 尤其是我这种对各种参数不甚了解的菜鸟

哦 我想起来了 这个application是app 安装到/Application目录下的 本身是不能做hook用的 tweak工程都是dylib 二者可以组合 但是app肯定是不能调用MSHook相关的函数,单纯引入没有用

我倒是不是app,我这个本身就是一个tweak,也替换了中间的substrate文件还是不行。。。哎

嗯 纯theos 开发模式 太高难度 建议还是用xcode 开发 比较容易掌控

换个Xcode就好了

xcode工程选项那里, 有个链接的第三方库, 要把substrate库写进去