I have a similar problem to the link below.
Categories in Objective-C aren't working
I'm a newbie to Objective C, so please excuse the ignorance. I need to support themes in my project, and I found this interesting solution (https://github.com/tombenner/nui) that I am trying to integrate into my solution. I have integrated the project as explained in the installation instructions on the nui page. This software is dependent on CoreParse which needs to be added as a sub-project to you app. I have done this.
The folder structure is as follows:
--CODE
--CoreParse
--MyApp
-ExternalProjects
I dragged the Coreparse project file into the ExternalProject Subfolder in my project.
When I run the project, I kept getting messages like "unrecognized selector sent to instance 0x81b42e0" which I fixed by simply combining ALL the category code into the parent class.
Now I am encountering the same error again, only this time it is in a category extension of the NSSet class in the Apple libraries, so my combining workaround will not suffice.
The error I get is:
2014-03-26 11:16:16.358 MomApp[1409:c07] -[__NSSetM cp_map:]: unrecognized selector sent to instance 0x81b0210
When I do a "po" on my error, I get the following:
po 0x81b0210
$0 = 139762688 {(
(null) ::= •
)}
Edit:
The code calling this comes from a packege I downloaded on github (CoreParse)
while ([processingQueue count] > 0)
{
NSSet *kernel = [processingQueue objectAtIndex:0];
NSSet *itemSet = [self lr0Closure:kernel];
//The next line causes the error
NSSet *validNexts = [itemSet cp_map:^ id (CPItem *item) {return [item nextSymbol];}];
for (CPGrammarSymbol *s in validNexts)
{
NSSet *g = [self lr0GotoKernelWithItems:itemSet symbol:s];
if (![c containsObject:g])
{
[processingQueue addObject:g];
[c addObject:g];
}
}
[processingQueue removeObjectAtIndex:0];
}
The .h and .m files where this extension resides are shown below:
.h File
//
// NSSetFunctional.h
// CoreParse
//
// Created by Tom Davie on 06/03/2011.
// Copyright 2011 In The Beginning... All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSSet(Functional)
- (NSSet *)cp_map:(id(^)(id obj))block;
@end
.m File
//
// NSSetFunctional.m
// CoreParse
//
// Created by Tom Davie on 06/03/2011.
// Copyright 2011 In The Beginning... All rights reserved.
//
#import "NSSetFunctional.h"
#import <Foundation/Foundation.h>
@implementation NSSet(Functional)
- (NSSet *)cp_map:(id(^)(id obj))block
{
NSUInteger c = [self count];
id *resultingObjects = malloc(c * sizeof(id));
NSUInteger nonNilCount = 0;
for (id obj in self)
{
id r = block(obj);
if (nil != r)
{
resultingObjects[nonNilCount] = r;
nonNilCount++;
}
}
NSSet *s = [NSSet setWithObjects:resultingObjects count:nonNilCount];
free(resultingObjects);
return s;
}
@end
I am at a loss as to how to get this to work. As I said, I am a newbie to IOS programming and this truly has me stumped. Any help would be greatly appreciated.