我正在使用 cocos2d 框架进行 iOS 游戏开发,我非常羡慕 Eclipse Java 程序员在调试应用程序时能够热交换代码(即更改方法中的变量值并让程序实时更新)就好像你有一个 REPL 而无需重新编译)。
这似乎对 iOS 开发非常有帮助,我的开发环境(显然)是 Xcode,我编程的语言是 Objective C。我用谷歌搜索但没能找到任何事情 - 所以我想我会问社区。p>
有人知道在使用 Objective C 编程时是否可以在 Xcode 中热交换代码吗?
提前致谢
最佳答案
有一个很棒的插件,可以在实时运行的 APP 中更改代码。它称为 InjectionPlugin。
如常见问题解答所述:
How does it work? The Objective-C runtime allows you to load a new version of a class into an application using a bundle even if there is already an implementation linked into the application. Swizzling is used as the bundle is loaded to switch the existing class to use the methods of the new implementation. This can be done repeatedly and works for OSX and iOS applications and on iOS devices.
我制作了一些小视频展示了如何安装和使用这个插件 http://nomtek.com/developers/how-to-install-and-use-injection-plugin-for-xcode/
希望对您有所帮助!
关于objective-c - Xcode 中的热代码交换?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10196155/