How can i add an id and selector to nsdictionary? These doesn’t works:
id target = mainTarget;
SEL selector=mainSelector;
NSDictionary *tAndS=[[NSDictionary alloc]initWithObjectsAndKeys:target,@"target",selector,@"selector", nil];
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The documentation says:
A selector does not conform to NSCopying, but you can convert one to a string (which does conform to the protocol):
The
idis no different. If your object conforms toNSCopyingthen you’re good to go. If not, you’ll have to wrap it in something that does, such asNSDataor just implementNSCopying(the latter would be “cleanest”).