the answer for this question is probably simple but currently I’m stumped and any help would be welcomed.
I have attached a contextual menu to a table view. One of the menu options is to delete the element in the tableview. I’m using a NSAlert to pop a modal window to confirm deletion. I’d like to pass along a value from the tableview to the alert selector so I have some reference to use for the delete.
here is the alert string:
[alert beginSheetModalForWindow:_window
modalDelegate:self
didEndSelector:@selector(deleteAlert:code:context:)
contextInfo:s];
any time I try to pass an object as the contextInfo I get a warning. If I try to pass NSInteger row (row from tableview) I get this compiler warning: warning: Semantic Issue: Incompatible integer to pointer conversion sending ‘NSInteger’ (aka ‘long’) to parameter of type ‘void *’
If I try to pass a string in variable name form I get this: error: Automatic Reference Counting Issue: Implicit conversion of an Objective-C pointer to ‘void *’ is disallowed with ARC. I also tried a dictionary without any luck.
However if I pass a string like this: contextInfo:@”some info”,I don’t get any errors and I can actually see it in the selector. which of course is kinda useless for my needs.
So, how do I pass the table row information into the alert so I can use it in the delete selector?
If you want to pass the row index, you can wrap it in an
NSNumberinstance: