Re: Multiple CBCentralManagers?
Re: Multiple CBCentralManagers?
- Subject: Re: Multiple CBCentralManagers?
- From: John Earl <email@hidden>
- Date: Thu, 02 May 2013 23:59:39 +0100
On 2 May 2013, at 23:57, John Earl wrote: On 2 May 2013, at 23:40, Rick Mann wrote:
On May 2, 2013, at 15:25 , Andras Kovi <email@hidden> wrote:
you shouldn't do that. Callbacks can easily be messed up, additionally, CB doesn't tolerate well the regular/stressful creation/deletion of managers. There have been several discussions on this topic, you may look them up jn the list archives.
Thanks, Andras; I'll stick to a single CM, and use some method to map CBPeripherals to my Core Data entities.
Apple could help a lot by allowing me to set arbitrary keys on CBPeripheral objects.
Write a category with getters and setters implemented with associated objects.
Just realised that might have been too cryptic if you haven't done this before. Code example:
@implementation CBPeripheral (AdvertisementData)
static char const advertisementDataRef;
-(NSDictionary*)advertisementData { return (NSDictionary*)objc_getAssociatedObject(self, &advertisementDataRef); }
-(void)setAdvertisementData:(NSDictionary*) aData { objc_setAssociatedObject(self, &advertisementDataRef, aData, OBJC_ASSOCIATION_RETAIN_NONATOMIC); }
@end |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden