ios开发中崩溃日志log
来源:互联网 发布:最后的狮子 知乎 编辑:程序博客网 时间:2024/05/23 12:00
typedef enum{
QFLogLevelFail = 0,
QFLogLevelError,
QFLogLevelWarning,
QFLogLevelInfo,
QFLogLevelDebug
}QFLogLevel;
void QFLogMessage(QFLogLevel level, BOOL waitUntilDone, NSString* message, …);
@interface QFLog : NSObject
{
QFLogLevel _level;
BOOL _isStarted;
NSThread *_thread;
NSString* _logDirectory;//日志文件目录NSFileHandle *_fileHandle;//日志文件句柄NSString* _logName;//日志文件名NSArray *_theLevelStringArray;NSDateFormatter *_dateFormatter;
}
@property (nonatomic, readwrite, assign) QFLogLevel level;
/**
* QFLog Singleton对象
*
* @return QFLog对象
*/
+ (QFLog *)sharedQFLog;
/**
* 开始记录日志
*/
- (void)startLogging;
/**
* 停止记录日志
*/
- (void)stopLogging;
- (BOOL)isFinished;
/**
* 删除旧日志
*/
- (void)removeOldLogs;
/**
* 上传日志
*/
- (void)uploadLogs;
@end
import “Dialog.h”
static UIWindow *g_alertWindow = nil;
@interface DialogViewController : UIViewController
{
UIView *_dialogView;
BOOL _modal;
}
@property(assign, readwrite, nonatomic) BOOL modal;
- (void)setDialogView:(UIView *)dialogView;
@end
@implementation DialogViewController
(void)dealloc
{
[_dialogView release];
_dialogView = nil;[super dealloc];
}(void)touchesBegan:(NSSet )touches withEvent:(UIEvent )event
{
if (_modal)
{
return;
}UITouch *touch = [touches anyObject];
CGPoint touchPoint = [touch locationInView:self.view];
if ( !CGRectContainsPoint(_dialogView.frame, touchPoint))
{
//关闭对话框
closeDialogView(QFCloseDialogViewAnimationNone, ^(BOOL finished) {});
}
}(void)viewDidLoad
{
[super viewDidLoad];
}
(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{CGFloat mainScreenWidth = [UIScreen mainScreen].bounds.size.width;
CGFloat mainScreenHeight = [UIScreen mainScreen].bounds.size.height;if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft
||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
_dialogView.center = CGPointMake(mainScreenHeight/2.0, mainScreenWidth/2.0);
}
else
{
_dialogView.center = CGPointMake(mainScreenWidth/2.0, mainScreenHeight/2.0);
}
}(void)setDialogView:(UIView *)dialogView
{
[dialogView retain];
[_dialogView release];
_dialogView = dialogView;CGFloat mainScreenWidth = [UIScreen mainScreen].bounds.size.width;
CGFloat mainScreenHeight = [UIScreen mainScreen].bounds.size.height;UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
if (orientation == UIDeviceOrientationLandscapeLeft
||
orientation == UIDeviceOrientationLandscapeRight)
{
_dialogView.center = CGPointMake(mainScreenHeight/2.0, mainScreenWidth/2.0);
}
else
{
_dialogView.center = CGPointMake(mainScreenWidth/2.0, mainScreenHeight/2.0);
}[self.view addSubview:dialogView];
}
@end
void showDialogView(UIView *view, BOOL modal, QFShowDialogViewAnimationOptions showDialogViewAnimationOption, void (^completion)(BOOL finished))
{
if (g_alertWindow == nil)
{
g_alertWindow = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
g_alertWindow.windowLevel = UIWindowLevelAlert; g_alertWindow.backgroundColor = [UIColor clearColor]; [g_alertWindow makeKeyAndVisible];}DialogViewController *dialogViewController = [[[DialogViewController alloc] init] autorelease];dialogViewController.modal = modal;g_alertWindow.rootViewController = dialogViewController;[dialogViewController setDialogView:view];if (showDialogViewAnimationOption == QFShowDialogViewAnimationNone){ if (completion != nil) { completion(YES); } return;}else if (showDialogViewAnimationOption ==QFShowDialogViewAnimationFromLeft){ view.layer.transform = CATransform3DTranslate(view.layer.transform, -g_alertWindow.bounds.size.width, 0, 0);}else if (showDialogViewAnimationOption ==QFShowDialogViewAnimationFromTop){ view.layer.transform = CATransform3DTranslate(view.layer.transform, 0, -g_alertWindow.bounds.size.height, 0);}else if (showDialogViewAnimationOption ==QFShowDialogViewAnimationFromRight){ view.layer.transform = CATransform3DTranslate(view.layer.transform, g_alertWindow.bounds.size.width, 0, 0);}else if (showDialogViewAnimationOption ==QFShowDialogViewAnimationFromBottom){ view.layer.transform = CATransform3DTranslate(view.layer.transform, 0, g_alertWindow.bounds.size.height, 0);}else if (showDialogViewAnimationOption ==QFShowDialogViewAnimationFromCenter){ view.layer.transform = CATransform3DScale(view.layer.transform, 0.001, 0.001, 1);}[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ view.layer.transform = CATransform3DIdentity; } completion:^(BOOL finished) { if (completion != nil) { completion(YES); } }];
}
void closeDialogView(QFCloseDialogViewViewAnimationOptions closeDialogViewViewAnimationOption, void (^completion)(BOOL finished))
{
CATransform3D transform;
if (closeDialogViewViewAnimationOption == QFCloseDialogViewAnimationNone){ if (g_alertWindow != nil) { [g_alertWindow release]; g_alertWindow = nil; } if (completion != nil) { completion(YES); } return;}else if (closeDialogViewViewAnimationOption == QFCloseDialogViewAnimationToLeft){ transform = CATransform3DTranslate(g_alertWindow.rootViewController.view.layer.transform, -g_alertWindow.frame.size.width, 0, 0);}else if (closeDialogViewViewAnimationOption == QFCloseDialogViewAnimationToTop){ transform = CATransform3DTranslate(g_alertWindow.rootViewController.view.layer.transform, 0, -g_alertWindow.frame.size.height, 0);}else if (closeDialogViewViewAnimationOption == QFCloseDialogViewAnimationToRight){ transform = CATransform3DTranslate(g_alertWindow.rootViewController.view.layer.transform, g_alertWindow.frame.size.width, 0, 0);}else if (closeDialogViewViewAnimationOption == QFCloseDialogViewAnimationToBottom){ transform = CATransform3DTranslate(g_alertWindow.rootViewController.view.layer.transform, 0,g_alertWindow.frame.size.height, 0);}else if (closeDialogViewViewAnimationOption == QFCloseDialogViewAnimationToCenter){ transform = CATransform3DScale(g_alertWindow.rootViewController.view.layer.transform, 0.001, 0.001, 1);}[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ g_alertWindow.rootViewController.view.layer.transform = transform; } completion:^(BOOL finished) { if (g_alertWindow != nil) { [g_alertWindow release]; g_alertWindow = nil; } if (completion != nil) { completion(YES); } }];
}
- ios开发中崩溃日志log
- iOS开发-应用崩溃日志分析(Crash Log)
- iOS开发-应用崩溃日志分析(Crash Log)
- iOS开发 中捕获程序崩溃日志
- iOS 崩溃日志 Crash Log 分析汇总
- 解析IOS崩溃日志(crash Log)
- 解析IOS崩溃日志(crash Log)
- 解析IOS崩溃日志(crash Log)
- 解析iOS崩溃日志(crash Log)
- 解析IOS崩溃日志(crash Log)
- crash Log- 解析IOS崩溃日志
- 在ios开发中怎么获取应用崩溃日志
- 崩溃日志log
- 友盟抓取crash Log- 解析IOS崩溃日志
- iOS开发笔记---应用崩溃日志揭秘
- iOS 中捕获程序崩溃日志
- iOS 中捕获程序崩溃日志
- iOS 中捕获程序崩溃日志
- Servlet生命周期
- 习惯四:双赢思维--人际领导的原则
- Git教程:Feature分支
- android:windowSoftInputMode属性应用
- 3006 The Number of set
- ios开发中崩溃日志log
- Apache中设置默认首页
- Git教程:多人协作
- 心急的C小加
- 关于我与IT
- Android 中图片压缩处理的方式(附源代码)
- Git教程:使用GitHub
- 第二章 面向对象的编程风格(使用静态局部变量)
- leetcode Count and Say