changed from didDismissWithButtonIndex to willDismissWithButtonIndex