December 2012
Intermediate to advanced
834 pages
27h
English
You want to present an alert to your user even when your application is not running. You want to create this alert locally inside your application without using push notifications.
Instantiate an object of type UILocalNotification and schedule it using the
scheduleLocalNotification: instance
method of UIApplication:
-(BOOL)localNotificationWithMessage:(NSString*)paramMessageactionButtonTitle:(NSString*)paramActionButtonTitlelaunchImage:(NSString*)paramLaunchImageapplicationBadge:(NSInteger)paramApplicationBadgesecondsFromNow:(NSTimeInterval)paramSecondsFromNowuserInfo:(NSDictionary*)paramUserInfo{if([paramMessagelength]==0){returnNO;}UILocalNotification*notification=[[UILocalNotificationalloc]init];notification.alertBody=paramMessage;notification.alertAction=paramActionButtonTitle;if([paramActionButtonTitlelength]>0){/* Make sure we have the action button for the user to pressto open our application */notification.hasAction=YES;}else{notification.hasAction=NO;}/* Here you have a chance to change the launch image of your applicationwhen the notification's action is viewed by the user */notification.alertLaunchImage=paramLaunchImage;/* Change the badge number of the application once the notification ispresented to the user. Even if the user dismisses the notification,the badge number of the application will change */notification.applicationIconBadgeNumber ...
Read now
Unlock full access