Re: [Pyobjc-dev] Problems implementing a protocol
Brought to you by:
ronaldoussoren
From: Mani G. <ma...@tu...> - 2010-03-03 16:31:45
|
On Mon, Feb 22, 2010 at 3:14 PM, Mani Ghasemlou <ma...@tu...> wrote: > Hello, > > Here is an XCode project that reproduces the issue. Thank you. > > Mani > > On Fri, Feb 19, 2010 at 1:54 PM, Mani Ghasemlou <ma...@tu...> wrote: >> Hello, >> >> This may or may not be a bridge bug, but either way I'll post it here >> and hopefully someone will be able to help. >> >> I am implementing a Python class (note: not a subclass of NSObject) >> that fulfills the ISyncSessionDriverDataSource protocol >> (http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/ISyncSessionDriverDataSource_Protocol/Reference/Reference.html). >> >> With this implementation passed in to the session driver, I've >> confirmed that functions in my class returning various Cocoa objects >> (NSDictionary, NSArray, NSURL) are being invoked and handled >> correctly. >> >> However, I am stuck on the preferredSyncModeForEntityName_() >> implementation. It is supposed to return type ISyncSessionDriverMode >> (http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/ISyncSessionDriverDataSource_Protocol/Reference/Reference.html#//apple_ref/doc/c_ref/ISyncSessionDriverMode), >> an enum. >> >> My code simply returns an enum value: >> >> def preferredSyncModeForEntityName_(self, entity): >> logging.debug('DRIVER requesting preferred sync mode') >> if self.refresh is True: >> logging.debug('returning ' + str(ISyncSessionDriverModeRefresh)) >> return ISyncSessionDriverModeRefresh >> else: >> logging.debug('returning '+ str(ISyncSessionDriverModeFast)) >> return ISyncSessionDriverModeFast >> >> From my understanding of both the documentation and the way PyObjC >> works, the above should just work, right? However it doesnt: >> >> 2010-02-19 13:29:46,908 DEBUG >> SyncDataSource.preferredSyncModeForEntityName_: DRIVER requesting >> preferred sync mode >> 2010-02-19 13:29:46,908 DEBUG >> SyncDataSource.preferredSyncModeForEntityName_: returning 1 >> ISyncSessionDriverDataSource <SyncDataSource.SyncDataSource object at >> 0x27ae070> responded poorly to preferredSyncModeForEntityName: with >> entity com.apple.calendars.Attendee >> >> Any ideas what could be wrong here? I have tried all of the enum >> values just to see if there's something wrong with my logic, but they >> all return the same error. This leads me to think that >> ISyncSessionDriver is not happy with the integer format used to return >> this enum value. Or maybe I'm just missing something obvious? >> >> Any help greatly appreciated! >> >> (OS X 10.5.8, standard system PyObjC installation: 2.0) >> >> Regards, >> Mani >> Just wanted to give this thread a bump. I am still blocked by this issue, and any responses, workarounds, insights or otherwise would be greatly appreciated! To restate the problem, I am implementing an informal protocol "ISyncSessionDriverDataSource". One of the methods to be implemented simply returns an enum value (in other words, an int) -- and the Sync Services framework complains no matter which of the acceptable enum values I return. Either I'm missing something (it's happened before) or there is a possible bug with with the bridge's SyncServices framework support. Apologies for bumping this with not much new to add, but I am very keen to get this issue resolved. :) Cheers, Mani |