ios - Attempt to dismiss from view controller (UIModalViewController) while a presentation or dismiss is in progress -


i have started working on ios. created modalviewcontroller (vc1) , presented modalviewcontroller (vc2). there button (dismiss) on vc2 have dismiss both viewcontrollers.

the way know call :-

[self dismissviewcontrolleranimated:yes completion:nil]; 

in vc2 call same in vc1

so created delegate tells me if dismiss clicked in vc2. when dismiss clicked:-

i call

[self dismissviewcontrolleranimated:yes completion:nil]; 

in vc2 delegate method takes me vc1 again call

[self dismissviewcontrolleranimated:yes completion:nil]; 

this method working till using app in ios9 when shifted ios7 started getting warning , vc1 not getting dismissed.

please let me know why happening.

so part works me told in comments.

[self.presentedviewcontroller dismissviewcontrolleranimated:yes completion:^{         [self dismissviewcontrolleranimated:yes completion:nil];     }]; 

so, error tells happened. trying dismiss vc1, while vc2 dismissing. putting dismissviewcontrolleranimated delegate method not guarantee vc1 dismissed before, instead of should call [self dismissviewcontrolleranimated:yes completion:nil]; in completion block after first dismiss, code that:

[self dismissviewcontrolleranimated:yes                          completion:^{                              [self dismissviewcontrolleranimated:yes completion:nil];                          }]; 

Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -