use AppleDelegate property instead of global variable.