我有一个与应用程序挂钩的调整 (tweak1) 该调整应该使用框架来执行一些代码。不幸的是,在 iOS7 中我无法做到这一点。
然而,当相同的代码在一个单独的调整(tweak2)中执行时,它运行得很好。
我的问题是我可以将字典从第一个调整 (tweak1) 发送到调整 2,以便它被执行。
我想我需要使用 CPDistributedNotificationCenter。但不确定。如果是这种情况,将不胜感激提供帮助的建议或示例。
非常感谢
CPDistributedNotificationCenter
should work or you could just use NSDistributedNotificationCenter
. It inherits from NSNotificationCenter
, which we all know how to use.
Another solution I can suggest is CFMessagePort
, which I'm using in my apps. I need to support iOS 4, which doesn't support NSDistributedNotificationCenter
, so I ended up using CFMessagePort
. It differs from notification model in that you can't send messages to everyone. You can only send messages between two known ports. But in your case it probably doesn't matter.
There is also the XPC API but I've never used it and can't say much about it. It's an IPC API so it should work. Many iOS components use it.