DJZombieCheck 0.5.0

DJZombieCheck 0.5.0

Dokay Dou 维护。



  • Dokay

DJZombieCheck

Version License Platform

What

Objective-C 僵尸对象检测工具,支持在发布模式下运行。

中文介绍

Features

  • 支持在发布模式和调试模式下运行;
  • 在僵尸对象执行的选择器中打印参数;

Requirements

  • Xcode 8 或更高版本
  • iOS 7.0 或更高版本

Demo

要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install

安装

CocoaPods

编辑 Podfile 文件并添加 DJZombieCheck

pod 'DJZombieCheck'

快速入门

示例日志

如果 DJZombieCheck 识别到僵尸对象,日志将像这样

    DJZombieCheck_Example[16900:6214512] Find zombie,class:__NSArrayM address:0x610000059110 selector:addObject: param:(
1
)

详细说明

1.DJZombieCheck is Enable default,if you want to disable it,just set  DJZombieCheckEnable(global variable) to NO:
    BOOL DJZombieCheckEnable = NO;
2.Xcode Zombie Objects open also:
If Xcode Zombie Objects and DJZombieCheck are enable,DJZombieCheck will disable itself auto.

3.Want to Save crash log and send it to server:
	- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
	{
	    //read last crash log and send it to server.
    
	    [NSObject startZombieCheckWithType:DJZombieCheckTypeAdvance zombieBlock:^(NSString *className, NSString *selectorName, NSArray *paramList) {
	        id paramLog = paramList ? paramList : @"dj_no_param";
	        NSString *zombieLog = [NSString stringWithFormat:@"Find Zombie,class:%@ selector:%@ param:%@\r\n",className,selectorName,paramLog];
	        NSLog(@"%@", zombieLog);
	        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Zombie Object find" message:zombieLog delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
	        [alert show];
        
	        //upload zombie object info and raise exception here.
	        //        abort();
	    }];
	    return YES;
	}
4.Memory release type:
	typedef NS_ENUM(NSInteger,DJZombieCheckType){
	    DJZombieCheckTypeDefault,//does not release memory for object has called release, memory usage will grow continuously.
	    DJZombieCheckTypeRelease,//release memory for object has called release. if zombie object called after its memory has rewrited,zombie check may not work.
	    DJZombieCheckTypeAdvance,//release object's memory when UIApplicationDidReceiveMemoryWarningNotification is post.
	};

联系

多凯多

许可证

DJZombieCheck 基于 MIT 许可证可用。查看 LICENSE 文件以获取更多信息。