updated Apdelegate.m