In my header file I declare this property:
The synthesizer is in the main file:
And here's the code where it crashes:
The line in red gets highlighted and in the crash log it says:
I declared it as a NSMutableArray, I set up the property to be read-write, and I cast it as a mutable array when I set it. I can't imagine what else I could do to try to make it accept [addObject] besides having an inelegant work around of copying my array's contents into a new array with a new object added in.
Many thanks to anyone who can offer some help with this.
Code:
@property (readwrite, retain) NSMutableArray *clippings;
The synthesizer is in the main file:
Code:
@synthesize clippings;
And here's the code where it crashes:
Code:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSString *clipPath = [[NSBundle mainBundle] pathForResource:@"Clippings" ofType:@"txt"];
NSString *clipString = [NSString stringWithContentsOfFile:clipPath encoding:NSUTF16BigEndianStringEncoding error:NULL];
self.clippings = (NSMutableArray *)[clipString componentsSeparatedByString:@"\n"];
if (![self.clippings containsObject:[UIPasteboard generalPasteboard].string])
{
[color="RED"][self.clippings addObject:[UIPasteboard generalPasteboard].string];[/color]
}
}
The line in red gets highlighted and in the crash log it says:
-[__NSArrayI addObject:]: unrecognized selector sent to instance 0x57571f0
I declared it as a NSMutableArray, I set up the property to be read-write, and I cast it as a mutable array when I set it. I can't imagine what else I could do to try to make it accept [addObject] besides having an inelegant work around of copying my array's contents into a new array with a new object added in.
Many thanks to anyone who can offer some help with this.
Last edited: