处理应用程序事件

Handling application events

我正在为 Android 和 iOS 构建跨平台应用程序。到目前为止,它主要是 Android,我正在学习如何使用 j2objc 来翻译稍后将被 iOS 使用的代码。

关于应用程序的架构问题——如何在与平台无关的代码中传递事件。例如,我有一个 class 下载一组文件并在下载每个文件时使用 Android 广播机制广播消息 - 有没有办法在纯 [=20= 中实现此通知交换]?有教程吗?

Guava has an eventbus package, which may meet your needs and is included in the j2objc distribution. To use it, include dist/lib/guava-14.0.1.jar (where "dist" is the path to a recent J2ObjC release) 在 j2objc 命令的 -classpath 中,并且 link 带有 -lguava 标志。