Replaced usage of [UIApplication sharedApplication].keyWindow in favour of [[UIApplication sharedApplication] windows][0] of fix issue Guided Access Mode.

Check answer at http://stackoverflow.com/questions/3359501/uiapplication-sharedapplication-keywindow-is-nil/21042976#21042976