Ok, here goes,
This is were I load the bundle :
NSString *bundlePath = (NSString*)[_configuration objectForKey: DRIVERBUNDLE_PATH]; NSBundle *bundle = [NSBundle bundleWithPath: bundlePath];
if (nil == bundle) { [errorLog addObject: [NSNumber numberWithInt: DRIVER_ERRORCODE_BUNDLEMISSINGATPATH]]; *logList = [NSArray arrayWithArray: errorLog]; return nil; }
Class driverClass = [bundle principalClass]; if ((nil == driverClass) || ![driverClass conformsToProtocol: @protocol(StorageDriverInterface)]) { [errorLog addObject: [NSNumber numberWithInt: DRIVER_ERRORCODE_BUNDLEMAINCLASSNOTCOMPLIANT]]; *logList = [NSArray arrayWithArray: errorLog]; return nil; } _bundle = bundle;
fine until there, then later in the same method inside a loop where I initialize several instances of the principal class:
id <StorageDriverInterface> aDriverInstance = [[driverClass alloc] init: driverConfig callingbackto: callback logTo: &interfaceInitLogList];
That instantiates the object whose class was loaded. Then in the same loop afterwards I want to add the previous id to an NSArray
id saID = [_parametersOfLatestInitializedSA objectForKey: CONFIG_SAID]; if ((nil != saID) && ([[saID class] isSubclassOfClass: [NSData class]])) { //[_instances addObject: aDriverInstance]; [_instanceIDs addObject: saID]; [mutableInstanceDict setObject: saID forKey: CONFIG_SAID]; } else { if (!errorOcurred) { [errorLog addObject: [NSNumber numberWithInt: index]]; errorOcurred = YES; } [errorLog addObject: [NSNumber numberWithInt: DRIVER_ERRORCODE_INSTANCEDIDNOTREPORTID]]; }
When I uncomment the addObject line above, later in the code NSFileManager throws a doesNotRespondToSelector exception, which is very odd.
On Apr 8, 2009, at 1:31 AM, Graham Cox wrote: On 08/04/2009, at 10:23 AM, Daniel Luis dos Santos wrote: The only thing I can think of, to see something like this is that I am probably overwriting the NSFileManager's class internal tables and therefore the message. When I comment out the assignment it all goes well.
The class that I instantiate from the bundle is handled through a protocol. The implementation is derived from an NSObject. I have considered using an NSPointerArray instead.
Show your code. This word description is not very enlightening to anyone except you, who are familiar with the code. Sounds like it could be an over-release problem, but without seeing the code, who knows? --Graham
|