当前位置:编程学习 > wap >>

IOS成长之路-推送(本地推送)

1、打开本地推送并设置属性
 
 
[cpp] 
NSString *str = @"本地推送的信息";  
    UIApplication *app = [UIApplication sharedApplication];  
    UILocalNotification *notification = [[UILocalNotification alloc]init];//初始化本地推送   
    notification.soundName = UILocalNotificationDefaultSoundName;//设置声音   
    notification.alertBody = str;//设置推送的消息   
    [app scheduleLocalNotification:notification];//实现本地推送的关键步骤,   
    [notification release];  
    [str release];  
 
NSString *str = @"本地推送的信息";
    UIApplication *app = [UIApplication sharedApplication];
    UILocalNotification *notification = [[UILocalNotification alloc]init];//初始化本地推送
    notification.soundName = UILocalNotificationDefaultSoundName;//设置声音
    notification.alertBody = str;//设置推送的消息
    [app scheduleLocalNotification:notification];//实现本地推送的关键步骤,
    [notification release];
    [str release];通过上面的方法可以实现推送的效果
 
 
2、本地推送的接受方法 
 
 
[cpp]
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification  
 
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
 
补充:移动开发 , IOS ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,