Re: How to unregister a device delegate
site_archiver@lists.apple.com Delivered-To: bluetooth-dev@lists.apple.com [_rfcommChannel setDelegate:nil]; On Sep 16, 2009, at 8:12 AM, Peter Sichel wrote: More specifically, if you open a channel to a device using: The caller becomes the delegate per the last parameter. When you later close the device using: [_rfcommChannel closeChannel] and [_bluetoothDevice closeConnection] Is there a better way? - Peter _______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/bluetooth-dev/cdooley%40apple.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/bluetooth-dev/site_archiver%40lists.a... I'm using Apple's RFComm sample code and have noticed that in Snow Leopard closing a Bluetooth device has become asynchronous. ioResult = [device openRFCOMMChannelAsync:&_rfcommChannel withChannelID:rfcommChannelID delegate:self]; If you then release the caller, your program will crash when the device object tries to call the previously registered delegate some arbitrary time later. There has to be some way to unregister a device delegate so you can be sure the device object will not attempt to call you after your delegate object has gone away. The existing sample code and framework headers fail to document this so I'm trying to figure out how to unregister my delegate. An ugly work around is to never release a delegate until your program quits. This email sent to cdooley@apple.com This email sent to site_archiver@lists.apple.com
participants (1)
-
Craig Dooley