码迷,mamicode.com
首页 > 移动开发 > 详细

【iOS开发-119】ipa打包、单元测试test、本地通知UILocalNotification

时间:2015-02-02 15:56:40      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:

(1)ipa打包,可以用Xcode,也可以用iTunes,用后者比较快。

具体教程:使用XCode和iTunes打包ipa i OS_ipa打包的方法


(2)单元测试(一般用于测试某一个方法是否可行等等)

——轻量化

——和程序target是单独分开的

——比较直观快读地知道测试结果

相对而言,还有集群测试(一般测试一些模块和功能)、压力测试(加大数据或者用户进行测试)


(3)本地通知

#import "ViewController.h"

@interface ViewController ()
- (IBAction)addLocalNotification:(id)sender;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    if ([[UIDevice currentDevice].systemVersion doubleValue]>=8.0) {
        UIUserNotificationSettings *setting=[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
        [[UIApplication sharedApplication]registerUserNotificationSettings:setting];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)addLocalNotification:(id)sender {
    //创建
    UILocalNotification *localNoti=[[UILocalNotification alloc]init];
    //设置
    localNoti.alertAction=@"开始玩游戏";//操作提示
    localNoti.alertBody=@"这是alertBody";//提示内容
    localNoti.repeatInterval=NSCalendarUnitDay;//提示间隔
    localNoti.applicationIconBadgeNumber=3;//badge number
    localNoti.fireDate=[NSDate dateWithTimeIntervalSinceNow:3];//什么时候开始提示
    //注册,先删除之前所有的,再添加,防止重复
    [[UIApplication sharedApplication] cancelAllLocalNotifications];
    [[UIApplication sharedApplication] scheduleLocalNotification:localNoti];
}
@end

如果需要点击本地通知,到特定的页面,则需要判断。

——程序在运行时,点击本地通知的话,会调用AppDelegate.m的如下方法。直接点击icon图标的话,就正常启动。

-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{
    
}


【iOS开发-119】ipa打包、单元测试test、本地通知UILocalNotification

标签:

原文地址:http://blog.csdn.net/weisubao/article/details/43408379

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!