Note that there are some explanatory texts on larger screens.

plurals
  1. PORandom Debugging / Wrong Memory Management
    primarykey
    data
    text
    <p>I have no idea what's wrong with my program... </p> <p>I think something bad with the memory management, cos every time I try to execute the app i have a different result from the simulator.</p> <p>When I run the app everything works fine. The date formatter works fine! I can see in the table all the cell formatted in the right way!</p> <p>The interface is a tabController whit 2 tableView to show the content of a database and a tab with a view used to add element to the db.</p> <p>If I go in the "Add Tab" i can add all the element I want, but when i switch back to the others tab the program crash with an "Exe_Bad_Access" (in the code below).</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)_tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [_tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { [[NSBundle mainBundle] loadNibNamed:@"MovieTableCell" owner:self options:NULL]; cell = nibLoadedCell; } // Configure the cell. UILabel *itemLabel = (UILabel *) [cell viewWithTag:1]; UILabel *priceLabel = (UILabel *) [cell viewWithTag:2]; UILabel *groupLabel = (UILabel *) [cell viewWithTag:3]; UILabel *dateLabel = (UILabel *) [cell viewWithTag:4]; NSDictionary *rowVals = (NSDictionary *) [shoppingListItems objectAtIndex:indexPath.row]; NSString *itemName = (NSString *) [rowVals objectForKey:@"item"]; itemLabel.text = itemName; int groupid = [(NSNumber *) [rowVals objectForKey:@"groupid"] intValue]; groupLabel.text = Group[groupid]; NSNumber *price = (NSNumber *) [rowVals objectForKey:@"price"]; priceLabel.text = [priceFormatter stringFromNumber: price]; NSDate *dateValue = (NSDate *) [rowVals objectForKey:@"dateadded"]; NSString *str = [dateFormatter stringFromDate:dateValue]; //--&gt;Here I got the Bad Access [dateLabel setText:str]; return cell; [itemLabel release]; [groupLabel release]; [priceLabel release]; [dateLabel release]; } </code></pre> <p>Here is the entire program, if someone want to have a look: <a href="http://cl.ly/A1yk" rel="nofollow">http://cl.ly/A1yk</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload