My code used to look like this:
NSMutableArray *newDependencies = [self.dependencies mutableCopy];
[newDependencies addObjectsFromArray:[aDependency dependencies]];
Now self.dependencies and [aDependency dependencies] both return
NSArrays. The code works very well provided that the array returned
by self.dependencies does not have 0 objects in it. But if the array
returned by self.dependencies does have 0 objects in it, then
newDependencies still has 0 objects in it after addObjectsFromArray is
executed. I was able to correct this behaviour with the following code:
NSMutableArray *newDependencies = [[NSMutableArray alloc] init];
[newDependencies addObjectsFromArray:self.dependencies];
[newDependencies addObjectsFromArray:[aDependency dependencies]];
This works fine even when the array returned by self.dependencies has
0 objects. But I'm puzzled as to why it functions differently than
the first version. Any ideas?
_______________________________________________
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 [EMAIL PROTECTED]