Skip to content

sebikeller/BEDistributedMessagingCenter

Repository files navigation

BEDistributedMessagingCenter

(BlocksEnhancedCPDistributedMessagingCenter)

This is a replacement class for CPDistributedMessagingCenter (Part of the AppSupport.framework on iOS), which gives you the posibility to process a reply asynchronously in a block.

Usage:

#import "BEDistributedMessagingCenter.h"
//...
BEDistributedMessagingCenter* center = [BEDistributedMessagingCenter centerNamed:@"aCenterName"];
rocketbootstrap_distributedmessagingcenter_apply(center); //iOS 7+ only
//...
[center sendMessageAndReceiveReplyName:@"aMessageName" userInfo:@{@"someKey": someData} toCallbackBlock:^(id answer) {
    //do something with answer;
}];

To use in your own project make sure you link to the library available in Cydia. Update your (Theos) makefile: include libbedistributedmessagingcenter and rocketbootstrap (iOS 7+).

Also make sure ARC is on.

TARGET := iphone:clang
[...]
ADDITIONAL_OBJCFLAGS = -fobjc-arc
[...]
yourProjectName_LIBRARIES = [...] rocketbootstrap libbedistributedmessagingcenter

Special Thanks

@joedj - for rewriting the block caching

@rpetrich - for pointing out memory leaks (unretainable blocks) and for the very streamlined version

@uroboro - for good tips

@DHowett - for clarification on ARC and blocks

About

CPDistributedMessagingCenter enhanced with Blocks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published