Re: Checking One Array Against Another
Re: Checking One Array Against Another
- Subject: Re: Checking One Array Against Another
- From: Klaus Backert <email@hidden>
- Date: Sat, 29 Nov 2008 19:22:23 +0100
On 29.11.2008, at 19:00, Pierce Freeman wrote:
The only problem with running that is that I get a error in the log
and it
doesn't seem to be working:
-[NSCFSet minusSet:]: mutating method sent to immutable object
My slightly modified code is below:
NSMutableSet *openApplicationsSet = [NSSet
setWithArray:openApplications];
NSSet *allowedApplicationsSet = [NSSet
setWithArray:applicationsAllowedMutableArray];
NSSet *badApplicationsSet = [openApplicationsSet
minusSet:allowedApplicationsSet];
badApplicationsSet is – as NSSet * – NOT mutable here, but you want to
mutate it – just as the compiler told you: "mutating method sent to
immutable object".
NSMutableSet * badApplicationsSet = ...
NSLog(badApplicationsSet);
Better, to avoid more crashs, would be:
NSLog(@"badApplicationsSet: %@", badApplicationsSet);
Klaus
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden