// 3.让应用程序可以接受远程事件
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
- (UIWindow *)appWindow {
id<UIApplicationDelegate> delegate = UIApplication.sharedApplication.delegate;
if ([delegate respondsToSelector:@selector(window)]) {
return delegate.window;
}
return [UIApplication.sharedApplication keyWindow];
}