I am trying to teach myself objective - I (~ 10yr first ago) very good with C ++ I thought it should not be very difficult, but after so many years of dragon and many mathematical programming languages, I am very strong at point and in this, what I think is probably happening due to this.
However, I have unreliable selector errors for methods that are definitely present in the document and the encoding output of the encoded output (which I am not aware of this is incorrect), it shows that Objects are started I have reduced the following example as I can. Here's a class I wrote:
// Graph.h #import & lt; Foundation / Foundation. H & gt; @ Interface Graph: NSBKect @ Property NSMutableSet * myObjects; - (id) initWithNumElements: (integer) total; - (NSMutableSet *) addOneMore: (NSMutableSet *) corner; - (NSMutableSet *) addTo: (NSMutableSet *) R: (NSMutableSet *) P; @end
And this is the implementation:
// graph.m #import "Graph.h" @ Keep the implementation graph // number 0. ., Total - 1 in its own objects - (id) initWithNumElements: (integer) total {self = [super init]; If (self) {NSMutableSet * objects = [[NSMutableSet alloc] init]; For (int i = 0; i
and I'm testing it with the following code:
// main.m #import & lt; Foundation / Foundation. H & gt; #import "Graph.h" int main (int argc, const char * argv []) {@autoreleasepool {graph = G = [[graph light] initWithNumElements: 6]; NSMutableSet * Result = [g addOneMore: [[NSMutableSet alloc] init]]; NSLog (@ "% @", result); } Return 0; } (I logically know that this code does not understand in any way, it is simple for something stupid that once understood only a small quantity. ) Get the error
2014-10-27 11: 19: 14.936 test [1469: 303] *** Exceptions to the exception due to exception Cancellation 'NSINIDADArgrant exception', reason: '- [__nssetad object:]: 0x100108a sent to unknown selector for example 20 '
and xcode me exactly "[r add object: v];" But Debug Stuff says that R is an NSMutableSet * and v is a _NFCSNumber * then what is the problem? It should be valid until I can tell.
Commented "line [//] [allObjects minusSet: set];" This was also causing an unrecognized selector error, which would change it with the loop for the above version. Even then that line should be valid as far as I can see, I can not understand what is wrong here.
In the addOneMore:
, line
NSMutableSet * allObjects = [copy self.myObjects];
does not specify a temporary set on all objects, but an irreversible
NSSet
. If you want a temporary copy, you need to use the mutableCopy
, even if the source container (set, array, glossary) is an unqualified type. Copy
returns an irreversible example.
You are getting an unrecognized selector error because addObject:
is not a valid selector for an unchanging set.
Comments
Post a Comment