PDA

View Full Version : [Resolved] NSMutableArray error I don't understand




Richard Birkett
Dec 19, 2011, 12:01 PM
I have this code:

- (void)multiplyWithPrimeFactor:(RBMPrimeFactor *)thePrimeFactor
{
bool success = false;
for (RBMPrimeFactor *factor in primeFactors) {
if (factor.primeNumber == thePrimeFactor.primeNumber) {
factor.exponent += thePrimeFactor.exponent;
success = true;
break;
}
}
if (!success) {
[primeFactors addObject:thePrimeFactor];
}
}

I have studied it with breakpoints to the best of my ability. When the execution reaches the if it gets an error about using the primeFactor selector. Both 'factor' and 'thePrimeFactor' appear in the bug area to be valid 'RBMPrimeFactor's with valid integer primeFactor iVars. Here is the top of the error:

2011-12-19 17:56:30.797 Maths[770:707] -[RBMPrimeFactor primeNumber]: unrecognized selector sent to instance 0x10059c160
2011-12-19 17:56:30.798 Maths[770:707] An uncaught exception was raised
2011-12-19 17:56:30.798 Maths[770:707] -[RBMPrimeFactor primeNumber]: unrecognized selector sent to instance 0x10059c160
2011-12-19 17:56:30.803 Maths[770:707] (
0 CoreFoundation 0x00007fff9220d286 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff91fe1d5e objc_exception_throw + 43
2 CoreFoundation 0x00007fff922994ce -[NSObject doesNotRecognizeSelector:] + 190
3 CoreFoundation 0x00007fff921fa133 ___forwarding___ + 371
4 CoreFoundation 0x00007fff921f9f48 _CF_forwarding_prep_0 + 232
5 Maths 0x00000001000034e9 -[RBMTerm multiplyWithPrimeFactor:] + 393
6 Maths 0x00000001000032c6 -[RBMTerm multiplyWithPrime:] + 102
7 Maths 0x00000001000020d3 -[RBMTerm initWithOwner:numerator:denominator:] + 355


If you would like to see more code or error text I will reply asap.

BIG EDIT

Really sorry, my problem was that I had @dynamic properties without implementation, such an idiot! Sorry.

Richard