Skip to content

Commit ce8b43f

Browse files
committed
Fix backwards compatibility with iOS4
1 parent 2643c8e commit ce8b43f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

FDTakeExample/FDTakeController.m

+6-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,12 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking
234234

235235
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
236236
{
237-
[picker dismissModalViewControllerAnimated:YES];
237+
// Workaround for iOS 4 compatibility http://stackoverflow.com/questions/12445190/dismissmodalviewcontrolleranimated-deprecated
238+
if ([self respondsToSelector:@selector(dismissViewControllerAnimated:completion:)])
239+
[picker dismissViewControllerAnimated:YES completion:nil];
240+
else
241+
[picker dismissModalViewControllerAnimated:YES];
242+
238243
if ([self.delegate respondsToSelector:@selector(takeController:didCancelAfterAttempting:)])
239244
[self.delegate takeController:self didCancelAfterAttempting:YES];
240245
}

0 commit comments

Comments
 (0)