What is the difference between UIApplication.sharedApplication.delegate.window and UIApplication.sharedApplication.keyWindow?

For most uses, they will be the same… but not always. [UIApplication sharedApplication].keyWindow is the window which is currently being displayed on the device. This is normally your application’s window, but could be a system window. [UIApplication sharedApplication].delegate.window is the window your application is expected to use. Which one should be used? Well that all … Read more

-[UIApplication delegate] must be called from main thread only

Just call it from the main thread like this. Objective-C dispatch_async(dispatch_get_main_queue(), ^{ [[UIApplication delegate] fooBar]; }); Swift DispatchQueue.main.async { YourUIControlMethod() } Reaching out to your app delegate like this, is a hint that your architecture could use a little cleanup. You can call delegates from any thread you want. You only need to make sure … Read more

Adding view on StatusBar in iPhone

You can easily accomplish this by creating your own window above the existing status bar. Just create a simple subclass of UIWindow with the following override of initWithFrame: @interface ACStatusBarOverlayWindow : UIWindow { } @end @implementation ACStatusBarOverlayWindow – (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { // Place the window on the correct level and … Read more

iOS Launching Settings -> Restrictions URL Scheme

AS @Nix Wang’s ANSWER THIS IS NOT WORK IN IOS 10 WARNING: This method will not work for devices running iOS 5.1 and greater – See Hlung’s comment below. It’s possible that the path component has a different name than the actual section, but it’s also possible that you can’t currently access that section straight … Read more