ios - Why are the UIImagePickerControllerDelegate methods not firing? -
i refactored app implement command pattern. end, trying silo of functionality appropriate command classes. have implemented pattern of commands, 1 exception. have command called harvestphotocommand
launches uiimagepickercontroller
, , want use command class picker's delegate. seems straightforward enough, reason delegate methods not being invoked.
here's code:
//header file @interface wsharvestphotocommand : wscommand < uinavigationcontrollerdelegate, uiimagepickercontrollerdelegate, mwphotobrowserdelegate > @end //from super class header file: @property (nonatomic, weak) wsmapviewengine *mapviewengine; //implementation file -(void)execute { _imagepicker = [[uiimagepickercontroller alloc] init]; _imagepicker.sourcetype = uiimagepickercontrollersourcetypecamera; _imagepicker.delegate = self; _imagepicker.navigationbar.barstyle = [wsappsettings sharedsettings].theme.barstyle; [self.mapviewengine.mapvc presentviewcontroller:_imagepicker animated:yes completion:nil]; } #pragma mark - uiimagepickercontrollerdelegate #pragma mark - - (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info { nslog(@"please hit me!"); } -(void)imagepickercontrollerdidcancel:(uiimagepickercontroller *)picker { nslog(@"or me!"); }
wscommand
nsobject
, self.mapviewengine
. self.mapviewengine.mapvc
uiviewcontroller
.
i have tried 2 experiments far. first, set delegate protocols on mapviewengine
, made delegate; second, did same mapvc
. both of these experiments worked, meaning delegate methods invoked in each of classes. proved uiimagepicker
implementation correct.
so why same not work command class? both , mapviewengine
nsobject know that's not problem. suppose make mapviewengine
or mapvc
delegate, whole reason i'm doing de-couple classes. i've been trying solve night, accept thoughts or suggestions @ point.
this (suggested in previous comment) memory management issue, delegate callbacks being fired object had been delegate has been released because not backed strong pointer.
as disabler points out delegation connection did not affect objects retain count (and didn't exception might have 2 years ago because delegate has been nil'd out..)
Comments
Post a Comment