nicklockwood / iVersion

[DEPRECATED]
http://www.charcoaldesign.co.uk/source/cocoa#iversion
Other
1.95k stars 292 forks source link

Use -[UIApplication keyWindow] instead of delegate window #54

Closed kylef closed 10 years ago

kylef commented 10 years ago

UIApplicationDelegate protocol doesn't have a window method, it's common convention that it has a property called window. However it is not enforced.

nicklockwood commented 10 years ago

You're mistaken. Window is a property of the AppDelegate protocol, and it is enforced (you'll get a compiler warning if you don't implement the window property on your delegate, and your app will crash on launch if it's nil).

Conversely, using application keyWindow is unsafe because the keyWindow won't == the main window if a UIAlertView is on screen at the point when you call it.

kylef commented 10 years ago

Hmm you are right, however the property was only added in iOS 5.0. This project supports iOS 4.3. Maybe the next release of iVersion should require iOS 5.0?

s.ios.deployment_target = '4.3'
nicklockwood commented 10 years ago

It would only be a problem if the user was making an app that only runs on iOS 4, since any app that supports the iOS5+ SDK is required to have the window property, even if it also works on 4.3x.