SilverFruity / OCRunner

Execute Objective-C code as script. AST Interpreter. iOS hotfix SDK.
MIT License
660 stars 149 forks source link

热更代码不支持宏定义、NSNotFound 无法使用,IBAction、IBOutlet关键字无法识别 #27

Closed halypot closed 1 year ago

halypot commented 2 years ago

OCRunner version: 1.2.7

热更代码不支持宏定义,想直接拷贝原生代码中的宏定义,编译器过不了,得重写,很麻烦,能否让编译器支持一下宏定义

NSNotFound 无法使用,

IBAction、IBOutlet关键字无法识别,能否做一下处理

感谢作者阁下。

SilverFruity commented 2 years ago
  1. 预编译(宏定义)是没法支持的。
  2. 关于 NSNotFound 常量,你可以在脚本内自己声明一个 NSInteger NSNotFound = ~(1 << 63); 或者 NSInteger NSNotFound = 9223372036854775807;,然后就可以正常使用了
  3. 关于 IBAction、IBOutlet 关键字已经在 realease 1.2.9 的 PatchGenerator 中支持了。
halypot commented 2 years ago
  1. 预编译(宏定义)是没法支持的。
  2. 关于 NSNotFound 常量,你可以在脚本内自己声明一个 NSInteger NSNotFound = ~(1 << 63); 或者 NSInteger NSNotFound = 9223372036854775807;,然后就可以正常使用了
  3. 关于 IBAction、IBOutlet 关键字已经在 realease 1.2.9 的 PatchGenerator 中支持了。

那能不能在热更代码中支持#define写法呢(PatchGenerator中支持#define语法,这样原生代码的#define就能直接拷贝过来了),这样的话就可以减少很多额外的工作,不然每次都需要把#define里面的内容转换一下,贴到热更代码中。 感谢作者阁下。

SilverFruity commented 2 years ago

define 写法就是预编译呀,如果是简单的 #define 变量定义,建议将其替换为全局变量代码

halypot commented 2 years ago

define 写法就是预编译呀,如果是简单的 #define 变量定义,建议将其替换为全局变量代码

好的