xcode4 - UITableView didSelectRowAtIndexPath error - when selecting item again -
A list of items was loaded on the UITableView and was able to click and show a warning for the selected row. But after saying "ok" on the alert and I'm already clicking on the selected row already, my code empties "Thread 1: Program received signal: EXC_BAD_ACCESS". Please take a look at the code below.
- (zero) tableview: (UITableView *) table view was SelectionRowAtIndexPath: (NSIndexPath *) index path {NSDictionary * playerselected = [Object object audit: indexPath.row]; NSString * video = [The selected value of players forKey: @ "video"]; NSString * msg = [[NSString alloc] initWithFormat: @ "You have selected% @", video]; UIAlertView * Warning = [[UIAlertView alloc] initWithTitle: @ "Player Selected" msg: msg Rep: Auto Cancel Button: @ "OK" other button titles: zero]; [Alerts show]; [Warning issued]; [Video release]; [Msg Release]; } Please suggest to me what the problem might be. Do not release
video When you receive a value from NSDictionary , you do not do it yourself unless you explicitly / Code> it. To be more specific, when you retrieve your string, it is still owned by the dictionary when you do release , then you are issuing that item Which you do not keep yourself, resulting in it being released more. As a result, it is deloculated, and when you try to access it, memory is no longer valid and your app crashes.
Comments
Post a Comment