【Topics】IPC: CPDistributedMessagingCenter (rocketbootstrap)

参考地址:

http://www.iphonedevwiki.net/index.php/CPDistributedMessagingCenter

http://www.iphonedevwiki.net/index.php/Updating_extensions_for_iOS_7


越狱后,Tweak之间的进程间通信,可以用CPDistributedMessagingCenter系列

iOS 7、iOS 8下,要用rocketbootstrap的成果。


刚开始用,一直不能进行通信,有时候甚至是造成崩溃问题。


我出现的问题,主要是

1.  Client Side Problem

- (NSDictionary *)handleMessageNamed:(NSString *)name withUserInfo:(NSDictionary *)userinfo {
    // Process userinfo (simple dictionary) and return a dictionary (or nil 一定要Return,不然会崩溃的 - -!)
}
 
- (void)handleSimpleMessageNamed:(NSString *)name {
    // ...
}

2。Server Side Problem:

#import "rocketbootstrap.h"
 
CPDistributedMessagingCenter *c = [CPDistributedMessagingCenter centerNamed:@"com.mycompany.myCenter"];
// apply rocketbootstrap regardless of iOS version (via rpetrich)
rocketbootstrap_distributedmessagingcenter_apply(c);
[c runServerOnCurrentThread];
[c registerForMessageName:@"myMessageName" target:myTarget selector:@selector(handleMessageNamed:withUserInfo:)];

最好不要把这段代码放在Dispatch_async中,可能会造成不接收的情况,具体也没有去详细测试~~~





  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值