Umeng日志记录和版本升级
【摘要】
-(void)OpenUMeng //打开友盟{ [MobClick setCrashReportEnabled:YES]; // 如果不需要捕捉异常,注释掉此行// [MobClick setLogEnabled:YES]; // 打开友盟sdk调试,注意Release发布时需要注释掉此行,减少io消耗 [MobC...
-(void)OpenUMeng //打开友盟
{
[MobClick setCrashReportEnabled:YES]; // 如果不需要捕捉异常,注释掉此行
// [MobClick setLogEnabled:YES]; // 打开友盟sdk调试,注意Release发布时需要注释掉此行,减少io消耗
[MobClick setAppVersion:XcodeAppVersion]; //参数为NSString * 类型,自定义app版本信息,如果不设置,默认从CFBundleVersion里取
//
[MobClick startWithAppkey:UMENG_APPKEY reportPolicy:(ReportPolicy) REALTIME channelId:@"YunFeng"];
// reportPolicy为枚举类型,可以为 REALTIME, BATCH,SENDDAILY,SENDWIFIONLY几种
// channelId 为NSString * 类型,channelId 为nil或@""时,默认会被被当作@"App Store"渠道
// [MobClick checkUpdate]; //自动更新检查, 如果需要自定义更新请使用下面的方法,需要接收一个(NSDictionary *)appInfo的参数
[MobClick checkUpdateWithDelegate:self selector:@selector(updateMethod:)];
[MobClick updateOnlineConfig]; //在线参数配置
}
- (void)updateMethod:(NSDictionary *)appInfo {
NSLog(@"update info %@",appInfo);
if([[appInfo objectForKey:@"update"] isEqualToString:@"YES"]==YES)
{
NSString *newVersion = [[NSString alloc]initWithString:[appInfo objectForKey:@"version"]];
self.newVersionPath = [[NSString alloc]initWithString:[appInfo objectForKey:@"path"]];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:[NSString stringWithFormat:@"有新版本V%@",newVersion] message:[NSString stringWithString:[appInfo objectForKey:@"update_log"]] delegate:self cancelButtonTitle:@"下次再说" otherButtonTitles:@"更新", nil];
[alert show];
}
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex==1)
{
NSURL *url = [NSURL URLWithString:self.newVersionPath]; [[UIApplication sharedApplication]openURL:url];
}
}
文章来源: zzzili.blog.csdn.net,作者:清雨小竹,版权归原作者所有,如需转载,请联系作者。
原文链接:zzzili.blog.csdn.net/article/details/11892917
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
作者其他文章
评论(0)