您的位置:首页 > 移动开发

IOS AppSupport.framework

2016-11-10 14:22 134 查看
参考地址: 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中,可能会造成不接收的情况,具体也没有去详细测试~~~
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: