Welcome, Guest
Username Password: Remember me

EXC_BAD_ACCESS in SCImagePickerCell on iPhone 4
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: EXC_BAD_ACCESS in SCImagePickerCell on iPhone 4

EXC_BAD_ACCESS in SCImagePickerCell on iPhone 4 1 year, 3 months ago #1

EDIT - not a STV issue.

Hi,

I am using STV 2.0 beta 5.

The EXC_BAD_ACCESS occurs after I take a photo on an iPhone 4 (front or back camera).

 
#0 0x33479464 in objc_msgSend
#1 0x0004df1e in -[SCImagePickerCell imagePickerController:didFinishPickingMediaWithInfo:] at SCTableViewCell.m:3171
#2 0x32233314 in -[UIImagePickerController _imagePickerDidCompleteWithInfo:]
#3 0x30321426 in PLNotifyImagePickerOfImageAvailability
#4 0x3033130e in -[PLUICameraViewController cameraView:photoSaved:]
#5 0x3034b39a in -[PLCameraView cropOverlay:didFinishSaving:]
#6 0x3036bf64 in -[PLCropOverlay(PhotoSaving) _savePhotoFinished:]
#7 0x33a5ebbe in -[NSObject(NSObject) performSelector:withObject:]
#8 0x33639794 in __NSThreadPerformPerform
#9 0x33a767dc in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
#10 0x33a485b6 in __CFRunLoopDoSources0
#11 0x33a47e5a in __CFRunLoopRun
#12 0x33a47c86 in CFRunLoopRunSpecific
#13 0x33a47b8e in CFRunLoopRunInMode
#14 0x33b0e4aa in GSEventRunModal
#15 0x33b0e556 in GSEventRun
#16 0x32099328 in -[UIApplication _run]
#17 0x32096e92 in UIApplicationMain
#18 0x000027fe in main at main.m:14


I am doing the following:

 
SCClassDefinition *sectionTwoDef = [SCClassDefinition definitionWithClass:[CSSignupDetails class]
withPropertyNames:[NSArray arrayWithObjects:@"photoName", nil]
withPropertyTitles:[NSArray arrayWithObjects:@"Profile Photo", nil]];
//...
SCPropertyDefinition *photoPropertyDef = [sectionTwoDef propertyDefinitionWithName:@"photoName"];
photoPropertyDef.type = SCPropertyTypeImagePicker;
//...
- (void)tableViewModel:(SCTableViewModel *)aTableViewModel
willConfigureCell:(SCTableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath {
 
if ([cell isKindOfClass:[SCImagePickerCell class]]) {
SCImagePickerCell *imagePickerCell = (SCImagePickerCell *)cell;
imagePickerCell.displayImageNameAsCellText = NO;
imagePickerCell.imagePickerController.allowsEditing = YES;
}
}
 
 


The section has just this one row. Perhaps that is part of the problem? EDIT: no, tried that.

EDIT: stepped through the debugger. It seems to crash when accessing the synthesized getter for modeledTableView in SCTableViewModel when trying to do this:

[self.ownerTableViewModel.modeledTableView reloadRowsAtIndexPaths:indexPaths 
withRowAnimation:UITableViewRowAnimationNone]


The modeledTableView points to an object but it does not seem to be the relevant table view. My IBOutlet property is setup as retained so I'm confused why my table view is no longer around after viewDidLoad finishes and (at some point later) the image picker tries to reference it... Hmmm.

Added NSZombieEnabled=YES to the executable's env.

2011-01-21 11:51:36.277 MyApp[4463:307] *** -[UITableView reloadRowsAtIndexPaths:withRowAnimation:]: message sent to deallocated instance 0xb0b800
 


OK, so something is wrong with how I'm setting up the UITableView to be modeled.

The controller is a regular UIViewController and not a UITableViewController. The view is designed in IB with a retained UITableView IBOutlet configured properly. I setup STV for this table view in viewDidLoad.

...

So a memory warning was issued which unloaded the view... It will gladly reload the view as needed and tries to but the table view is gone.

This is not a STV issue so nevermind!

Thanks,
Brian
  • fictorial
  • OFFLINE
  • Fresh Boarder
  • Posts: 15
  • Karma: 3
Last Edit: 1 year, 3 months ago by fictorial.

Re: EXC_BAD_ACCESS in SCImagePickerCell on iPhone 4 1 year, 3 months ago #2

Hi Brian,

I'll be glad to look into this if you can send me your project file (to our support email please).
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: EXC_BAD_ACCESS in SCImagePickerCell on iPhone 4 1 year, 3 months ago #3

It's ok... It was mishandling of low memory warnings. You have to nil the objects and views you retain in viewDidUnload.
  • fictorial
  • OFFLINE
  • Fresh Boarder
  • Posts: 15
  • Karma: 3
  • Page:
  • 1
Time to create page: 0.82 seconds