Fix crash when using Xcode fullscreen mode. @kemenaran Thanks for reporting!
Add additional checks to avoid crashes.
Use NSString formatting recommended by Xcode.