作者:sanfengflying
NSDistributedNotificationCenter 是个好东西,在mac上可以进程间通讯,可惜iOS不支持,参考
http://stackoverflow.com/questions/14582854/various-types-of-notification-centers-available-for-ios,如果要进程间通讯可以考虑
1.私有框架<code>/System/Library/PrivateFrameworks/AppSupport.framework中的</code><code>CPDistributedMessagingCenter</code>
Documentation here: http://iphonedevwiki.net/index.php/CPDistributedMessagingCenter
Example codes of mine here:
https://github.com/H2CO3/PwnTube
https://github.com/H2CO3/Cereal
2. CMessagePort
3. mmap
.......
如果你还不死心,非要用此NSDistributedNotificationCenter,可以,自己定义接口,
//发送方
@interface NSDistributedNotificationCenter : NSNotificationCenter
+ (id)defaultCenter;
- (void)postNotificationName:(NSString *)aName object:(NSString *)anObject userInfo:(NSDictionary *)aUserInfo;
@end
//接收方
- (void)addObserver:(id)observer selector:(SEL)aSelector name:(NSString *)aName object:(NSString *)anObject;
- (void)removeObserver:(id)observer name:(NSString *)aName object:(NSString *)anObject;
重新定以后,就可以和原来一样用了,因为在ios上这些库没有被导出,用class-dump还是能够看到的。
网络上志同道合,我们一起学习网络安全,一起进步,QQ群:694839022