Sorry. Sent the original to another list
Begin forwarded message:
From: Daniel Luis dos Santos <daniel.d...@gmail.com>
Date: April 8, 2009 1:02:18 PM GMT+01:00
To: Graham Cox <graham....@bigpond.com>
Cc: list Xcode-users <xcode-us...@lists.apple.com>
Subject: Re: Storing bundle loaded main class instances in NSArray
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
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com