Note that there are some explanatory texts on larger screens.

plurals
  1. POXcode 5 and iOS 7 Simulator/Device Crash with zombie error - Works on iOS6
    primarykey
    data
    text
    <p>ARC=Code that executes without exception under iOS 6, fails under iOS 7 (device &amp; simulator) with:</p> <pre><code>*** -[UISwitch _sendActionsForEvents:withEvent:]: message sent to deallocated instance 0x14d50960 </code></pre> <p><strong>Profile for zombies reveals:</strong></p> <pre><code># Event Type ∆ RefCt RefCt Timestamp Responsible Library Responsible Caller 0 Malloc +1 1 00:13.542.198 Salon Clients -[ApplicationSettingViewController tableView:cellForRowAtIndexPath:] 1 Retain +1 2 00:13.542.696 UIKit -[UIView(Internal) _addSubview:positioned:relativeTo:] 2 Release -1 1 00:13.542.721 Salon Clients -[ApplicationSettingViewController tableView:cellForRowAtIndexPath:] 3 Retain +1 2 00:13.542.843 UIKit -[UIView(Hierarchy) subviews] 4 Retain +1 3 00:13.542.846 Salon Clients -[ApplicationSettingViewController tableView:cellForRowAtIndexPath:] 5 Release -1 2 00:13.542.889 Salon Clients -[ApplicationSettingViewController tableView:cellForRowAtIndexPath:] 6 Retain +1 3 00:13.553.959 QuartzCore -[CALayer layoutSublayers] 7 Release -1 2 00:13.553.959 QuartzCore -[CALayer layoutSublayers] 8 Retain +1 3 00:16.099.687 UIKit -[UIWindow sendEvent:] 9 Autorelease 00:16.099.687 UIKit -[UIWindow sendEvent:] 10 Release -1 2 00:16.101.161 UIKit _wrapRunLoopWithAutoreleasePoolHandler 11 Retain +1 3 00:16.102.913 UIKit forwardTouchMethod 12 Release -1 2 00:16.102.935 UIKit forwardTouchMethod 13 Retain +1 3 00:16.212.121 Salon Clients -[ApplicationSettingViewController toggleReceived:event:] 14 Retain +1 4 00:16.213.223 Salon Clients -[ApplicationSettingViewController toggleReceived:event:] 15 Release -1 3 00:16.220.297 UIKit -[UIView(Internal) _invalidateSubviewCache] 16 Release -1 2 00:16.220.326 UIKit -[UIView(Hierarchy) removeFromSuperview] 17 Release -1 1 00:16.228.818 Salon Clients -[ApplicationSettingViewController toggleReceived:event:] 18 Release -1 0 00:16.228.819 Salon Clients -[ApplicationSettingViewController toggleReceived:event:] 19 Zombie -1 00:16.229.176 UIKit __31-[UISwitch _handleLongPressNL:]_block_invoke </code></pre> <p>There are, obviously, no manual retain/release cycles. The very strange call at the end of this history includes _handleLongPressNL This is not a gesture recognizer that I've added anywhere in this class.</p> <p>The code is adding a UISwitch to the accessoryView of a UITableViewCell and adding a target to call when the switch is changed.</p> <p>The method called when the switch is changed, records the changed state into standard defaults.</p> <p>I would appreciate any help.</p> <p>Thanks!</p> <p>Jim</p> <p>Where the UISwitch is defined and added to the cell.accessoryView</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ NSDictionary *prefItem = [prefSpecifierArray objectAtIndex:[indexPath row]+1]; //NSLog( @"Preference Array: %@", prefItem ); NSString *keyValueStr = [prefItem objectForKey:@"Key"]; NSString * title = [prefItem objectForKey:@"Title"]; //NSString * prefType = [prefItem objectForKey:@"Type"]; //NSLog(@"%@ %@ %@", keyValueStr, defaultValue, prefType ); // NSString * settingValue = [[NSUserDefaults standardUserDefaults] stringForKey:keyValueStr]; NSString * valueType = [prefItem objectForKey:@"Type"]; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:nil]; if (cell == nil){ if( [valueType isEqualToString:@"PSToggleSwitchSpecifier"] ) { cell.textLabel.adjustsFontSizeToFitWidth = YES; cell.textLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:18]; cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];// autorelease]; cell.contentView.autoresizesSubviews = YES; CGRect toggleFrame; if ( iPad ) { if ( SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0") ) { toggleFrame = CGRectMake( 0, 0, 49, 27);//225+(768-370) } else { toggleFrame = CGRectMake( 0, 0, 79, 27);//225+(768-370) } } else { if ( SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0") ) { toggleFrame = CGRectMake( 0, 0, 49, 27); } else { toggleFrame = CGRectMake( 0, 0, 79, 27);//225+(768-370) } } UISwitch * toggle = [[UISwitch alloc] initWithFrame:toggleFrame]; //toggleFrame = toggle.frame; toggle.tag = [indexPath row]+1; toggle.on = [prefItem objectForKey:@"DefaultValue"]; // NSString * onString = [prefItem objectForKey:@"TrueValue"]; // NSString * offString = [prefItem objectForKey:@"FalseValue"]; //haven't figured out what to do with this information at this time, I don't know how to change the label text in such a way //that is durable across localization issues [toggle addTarget:self action:@selector(toggleReceived:event:) forControlEvents:UIControlEventTouchUpInside]; toggle.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; if ( SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0") ) { cell.accessoryView = [[UIView alloc] initWithFrame:CGRectMake( 0, 0, 49, 27)]; } else { cell.accessoryView = [[UIView alloc] initWithFrame:CGRectMake( 0, 0, 79, 27)]; } [cell.accessoryView addSubview:toggle]; [cell.accessoryView bringSubviewToFront:toggle]; } }//end of cell definition if( [valueType isEqualToString:@"PSToggleSwitchSpecifier"] ) { cell.textLabel.adjustsFontSizeToFitWidth = YES; cell.textLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:17]; cell.textLabel.text = title; if ( [keyValueStr isEqualToString:@"fastRefresh"] &amp;&amp; iPad ){ cell.textLabel.text = @"Fast Background Refresh for Style Center Menu"; } // NSLog( @"%@", title ); NSArray * cellsViews = cell.accessoryView.subviews; for ( UIView * cellSubView in cellsViews ) { if ( cellSubView.tag &gt; 0 ) { UISwitch * toggle = (UISwitch*)cellSubView; // CGRect cellFrame = cell.frame; // CGRect toggleFrame = toggle.frame; toggle.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; // [[NSUserDefaults standardUserDefaults] removeObjectForKey:keyValueStr]; // BOOL switchValue = [prefItem objectForKey:@"DefaultValue"]; // [[NSUserDefaults standardUserDefaults] setBool:switchValue forKey:keyValueStr]; if ( ![[NSUserDefaults standardUserDefaults] objectForKey:keyValueStr] ){ BOOL switchValue = [prefItem objectForKey:@"DefaultValue"]; [[NSUserDefaults standardUserDefaults] setBool:switchValue forKey:keyValueStr]; [[NSUserDefaults standardUserDefaults] synchronize]; } if ( [[NSUserDefaults standardUserDefaults] boolForKey:keyValueStr] ) { toggle.on = YES; } else { toggle.on = NO; } if ( [keyValueStr isEqualToString:@"display24Time"] ) { if ( ![[NSUserDefaults standardUserDefaults] objectForKey:@"display24Time"] ){ display24Hour = [prefItem objectForKey:@"DefaultValue"]; } else { display24Hour = [[NSUserDefaults standardUserDefaults] boolForKey:@"display24Time"]; } } } } } return cell; } </code></pre>
    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