I got to work on ios push notification for an web based app.
but I am practicing local push first while I am pending state in IOS developer program.
I found source code of local push and adjusted the code to two places where I thought the right place
- viewController.h, viewController.m.
below is the two files.
viewController.h file
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (strong, nonatomic) IBOutlet UITextField *timeTextField;
- (IBAction)onSaveAlertTime:(id)sender;
@end
viewController.m file
(IBAction)onSaveAlertTime:(id)sender {
// Do any additional setup after loading the view, typically from a nib.
UILocalNotification *localNofication = [[UILocalNotification alloc] init];
if (localNofication == nil) return;
NSDate *pushDate = [[NSDate date] dateByAddingTimeInterval:[timeTextField.text intValue]];
localNofication.fireDate = pushDate;
localNofication.timeZone = [NSTimeZone defaultTimeZone];
localNofication.alertBody = @"Local Push Notification!";
localNofication.alertAction = @"View";
localNofication.soundName = UILocalNotificationDefaultSoundName;
localNofication.applicationIconBadgeNumber = 1;
NSDictionary *userInfo = [NSDictionary dictionaryWithObject: @"오늘의 일정은 로컬푸시를 테스트하는 것 입니다" forKey:@"message"];
localNofication.userInfo = userInfo;
[[UIApplication sharedApplication] scheduleLocalNotification:localNofication];
}
It looks like my viewController.m file does not reconize timeTextField object which declared
in viewController.h file. What should I do to reconize timeTextField object?