iOS app崩溃收集
2016-02-17 11:17
369 查看
1. 友盟 http://www.umeng.com/
但现在还只支持oc ,不支持swift ,如果是swift代码有问题,捕捉不到问题
2. NSSetUncaughtExceptionHandler 也是不支持swift
MyUncaughtExceptionHandler.h :
MyUncaughtExceptionHandler.m :
在didFinishLaunchingWithOptions方法中:
3. bugly : 支持swift http://bugly.qq.com/iosfast#access
4. 漫谈iOS Crash收集框架 /article/1316410.html
5 iOS自带的崩溃日志bug收集功能 :a . 从xcode找到devices 选项中的view devices logs
b. 应用提交到app store后可从 iTunes Connect 获取
c. 请用户将设备与电脑上的iTunes Store同步后,系统会将崩溃日志保存在电脑上,让用户email发送给开发者
参考文档(案例分析):http://www.cocoachina.com/industry/20130725/6677.html
但现在还只支持oc ,不支持swift ,如果是swift代码有问题,捕捉不到问题
MobClick.setCrashReportEnabled(true) MobClick.setLogEnabled(true) let version:String = NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleShortVersionString") as! String MobClick.setAppVersion(version) MobClick.startWithAppkey("", reportPolicy: REALTIME, channelId: nil)
2. NSSetUncaughtExceptionHandler 也是不支持swift
MyUncaughtExceptionHandler.h :
#import <Foundation/Foundation.h> @interface MyUncaughtExceptionHandler : NSObject + (void)setDefaultHandler; + (NSUncaughtExceptionHandler *)getHandler; + (void)TakeException:(NSException *) exception; @end
MyUncaughtExceptionHandler.m :
#import "MyUncaughtExceptionHandler.h" NSString * applicationDocumentsDirectory() { return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; } void UncaughtExceptionHandler(NSException * exception) { NSArray * arr = [exception callStackSymbols]; NSString * reason = [exception reason]; NSString * name = [exception name]; NSString * url = [NSString stringWithFormat:@"========异常错误报告========\nname:%@\nreason:\n%@\ncallStackSymbols:\n%@",name,reason,[arr componentsJoinedByString:@"\n"]]; NSString * path = [applicationDocumentsDirectory() stringByAppendingPathComponent:@"Exception.txt"]; [url writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:nil]; NSLog(@"%s:%d %@", __FUNCTION__, __LINE__, url); //NSString *urlStr = [NSString stringWithFormat:@"mailto:wy@91goal.com?subject=客户端bug报告&body=很抱歉应用出现故障,感谢您的配合!发送这封邮件可协助我们改善此应用<br>" // "错误详情:<br>%@<br>--------------------------<br>%@<br>---------------------<br>%@", // name,reason,[arr componentsJoinedByString:@"<br>"]]; //NSURL *url2 = [NSURL URLWithString:[urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; //[[UIApplication sharedApplication] openURL:url2]; } @implementation MyUncaughtExceptionHandler -(NSString *)applicationDocumentsDirectory { return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; } + (void)setDefaultHandler { NSSetUncaughtExceptionHandler(&UncaughtExceptionHandler); } + (NSUncaughtExceptionHandler *)getHandler { return NSGetUncaughtExceptionHandler(); } + (void)TakeException:(NSException *)exception { NSArray * arr = [exception callStackSymbols]; NSString * reason = [exception reason]; NSString * name = [exception name]; NSString * url = [NSString stringWithFormat:@"========异常错误报告========\nname:%@\nreason:\n%@\ncallStackSymbols:\n%@",name,reason,[arr componentsJoinedByString:@"\n"]]; NSString * path = [applicationDocumentsDirectory() stringByAppendingPathComponent:@"Exception.txt"]; [url writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:nil]; NSLog(@"%s:%d %@", __FUNCTION__, __LINE__, url); } @end
在didFinishLaunchingWithOptions方法中:
// NSSetUncaughtExceptionHandler({ // ex in // print("-------------UncaughtExceptionHandler---------------") // print(ex) // }) MyUncaughtExceptionHandler.setDefaultHandler()
3. bugly : 支持swift http://bugly.qq.com/iosfast#access
4. 漫谈iOS Crash收集框架 /article/1316410.html
5 iOS自带的崩溃日志bug收集功能 :a . 从xcode找到devices 选项中的view devices logs
b. 应用提交到app store后可从 iTunes Connect 获取
c. 请用户将设备与电脑上的iTunes Store同步后,系统会将崩溃日志保存在电脑上,让用户email发送给开发者
参考文档(案例分析):http://www.cocoachina.com/industry/20130725/6677.html
相关文章推荐
- 创建IOS项目的配置
- iOS 设计模式之简单工厂方法模式(SimpleFactoryMethod)
- Coursera课程Python for everyone:Quiz: Object Oriented Programming
- 详解Android自定义控件属性
- android点击ListView的item后变色
- DeviceOne 让你一见钟情的App快速开发平台
- Swift添加Preprocessor Macros
- Android自定义ViewPager实例
- ios开发中的Swift面向对象
- 高屋建瓴 cocos2d-x-3.0架构设计 Cocos2d (v.3.0) rendering pipeline roadmap(原文)
- H5移动端知识点总结
- WRANGLING DALVIK: MEMORY MANAGEMENT IN ANDROID
- IOS本地地图使用
- Android实现平铺图片效果
- android DisplayMetrics
- MindMapper 16中怎样添加标签
- 此证书的签发者无效Missing iOS Distribution signing identity问题解决
- iOS-NSMutableAttributedString富文本的实现
- android remount失败
- Android数据库更新并保留原来数据的实现