Code Monkey home page Code Monkey logo

cocoadebug's Introduction

logo
Version CocoaPods Compatible
Platform Platform
Languages Languages

Screenshot

Introduction

  • As similar with Charles in your App.

  • Shake to hide or show the black bubble. (Support iPhone device and simulator)

  • Share network details via email or copy to clipboard when you are in the Network Details page.

  • Copy logs. (Long press the text, then select all or select copy)

  • Search logs by keyword.

  • Long press the black bubble to clean all network logs.

  • Detect UI Blocking.

  • List crash errors.

  • List application and device informations, including: version, build, bundle name, bundle id, screen resolution, device, iOS version

  • List all network requests sent by the application. (Support JSON and Google's Protocol buffers)

  • List all sandbox folders and files, supporting to preview and edit.

  • List all WKWebView consoles.

  • List all React Native JavaScript consoles and Native logs.

  • List all print() and NSLog() messages which have been written by developer in Xcode.

Installation

CocoaPods (Preferred)

target 'YourTargetName' do
    use_frameworks!
    pod 'CocoaDebug', :configurations => ['Debug']
end

Carthage

github  "CocoaDebug/CocoaDebug"

Framework

CocoaDebug.framework (Version 1.7.2)

WARNING: Never ship a product which has been linked with the CocoaDebug framework. The Integration Guide outline a way to use build configurations to isolate linking the framework to Debug builds.

Usage

  • Don't need to do anything. CocoaDebug will start automatically.
  • To capture logs from Xcode with codes: (You can also set this in CocoaDebug->App->Monitor->Applogs without any codes.)
CocoaDebugSettings.shared.enableLogMonitoring = true //The default value is false

Parameters

When you initialize CocoaDebug, you can customize the following parameter values before CocoaDebug.enable().

  • serverURL - If the captured URLs contain server URL, CocoaDebug set server URL bold font to be marked. Not mark when this value is nil. Default value is nil.

  • ignoredURLs - Set the URLs which should not been captured, CocoaDebug capture all URLs when the value is nil. Default value is nil.

  • onlyURLs - Set the URLs which are only been captured, CocoaDebug capture all URLs when the value is nil. Default value is nil.

  • ignoredPrefixLogs - Set the prefix Logs which should not been captured, CocoaDebug capture all Logs when the value is nil. Default value is nil.

  • onlyPrefixLogs - Set the prefix Logs which are only been captured, CocoaDebug capture all Logs when the value is nil. Default value is nil.

  • additionalViewController - Add an additional UIViewController as child controller of CocoaDebug's main UITabBarController. Default value is nil.

  • emailToRecipients - Set the initial recipients to include in the email’s “To” field when share via email. Default value is nil.

  • emailCcRecipients - Set the initial recipients to include in the email’s “Cc” field when share via email. Default value is nil.

  • mainColor - Set CocoaDebug's main color with hexadecimal format. Default value is #42d459.

  • protobufTransferMap - Protobuf data transfer to JSON map. Default value is nil.

Reference

https://developer.apple.com/library/archive/samplecode/CustomHTTPProtocol/Introduction/Intro.html

cocoadebug's People

Contributors

8secz-johndpope avatar cdoky avatar cocoadebug avatar codwam avatar dklinzh avatar helloworld1980 avatar hideyuki-okuni avatar hoaye avatar iblacksun avatar kagenzhao avatar kofktu avatar mqzhot avatar ohkanghoon avatar pandaape avatar philosopherdog avatar supery avatar taoshotaro avatar ttuygun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cocoadebug's Issues

some suggestion

这种小工具其实可以不让业务方初始化的,自己监听一下didFinishLaunch通知,在通知回调里初始化就好了,不用让调用者来区分DEBUG、RELEASE还或者是其他环境,因为在Podfile里就可以限制

log problem

我的引用代码:

#ifdef DEBUG
#define LRString [NSString stringWithFormat:@"%s", __FILE__].lastPathComponent
#define NSLog(fmt, ...) [CocoaDebug objcLog:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] :NSStringFromSelector(_cmd) :__LINE__ :(fmt, ##__VA_ARGS__) :[UIColor whiteColor]]
#else
static const DDLogLevel ddLogLevel = DDLogLevelWarning;
#if defined(OM_BETA) || defined(OM_TEST)
#define NSLog(fmt, ...) [CocoaDebug objcLog:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] :NSStringFromSelector(_cmd) :__LINE__ :(fmt, ##__VA_ARGS__) :[UIColor whiteColor]]
#else
#define NSLog DDLogError
#endif

#endif

#endif

报错:
Controller/AddTimeApplyController.m:446:9: error: sending 'CGFloat' (aka 'double') to parameter of incompatible type 'id _Nonnull'
NSLog(@"%f",progress);

//////////////////////////////////////////////////////////////////

NSLog(""),里面必须是NSString?

Share Log

Hi,
Is possible have a new feature to share log via email?

Thanks
Best Regards

Our app stops responding when it’s running in the simulator

Steps:
Install CocoaDebug in our project by following the instructions (or use the Example_Obj project). Then, debug our project in Xcode by pressing ⌘+R;
Press ⌘+. to stop running the app in the simulator;
Run our app directly in the simulator, and it stops responding.

It seems that the issue only occurs in the simulator. We haven’t found this bug in real devices yet.

two Bugs when use it

引入 CocoaDebug 以后
1:项目禁止了横屏, 但是横竖屏的时候, 界面跳动了一下, 随便还是竖屏的,但是这感觉很奇怪
2:顶部状态栏 黑色 白色 的切换 也因为 启动了CocoaDebug , 重写系统方法 变得无效。

Log Ephemeral session

Actually, ephemeral session aren't logged in network log.
Is correct or we wrong something?
We need to log also this type of session, it can be possible?

Thanks

malloc: *** error for object: pointer being freed was not allocated

Hi,
i keep getting this exception : "malloc: *** error for object: pointer being freed was not allocated"
when i am making this call: swiftHandleLog(file, function, line, message, color)
I'm getting this exception almost every time but if i mark this line (and just prints the same text) everything goes well an the app works just fine.
can you tell what may cause this problem?
am i doing something wrong?

edit:
the crash happens on LogHelper.swift at line 35: LogStoreManager.shared.addLog(newLog)

NSLog warning

警告:Expression result unused

方法 objcLog 也没有 返回值啊

求解

谢谢

具体的 是这样 :

想打印 一个 int 或者 float 或者 NSInteger 数值

NSLog(@"num:%ld",index);
报错:Implicit conversion of 'int' to 'id _Nonnull' is disallowed with ARC

然后我转成 NSNumber

NSLog(@"num:%@",[NSNumber numberWithInt:index]);

就出现 警告:Expression result unused

StatusBarColor Changed

In our project, the StatusBarColor was light. But when we import CocoaDebug to our project, the StatusBarColor became black.

use of undeclared identifier 'LogHelper'

I use the latest master branch code, but the compiler complains

[17:40:39]: ▸ ❌  /Users/wangpeng/workspace/ios/smarthome-ios/SmartHome/Pods/CocoaDebug/Sources/Core/CocoaDebugLog.m:29:14: use of undeclared identifier 'LogHelper'
[17:40:39]: ▸ [LogHelper.shared objcHandleLogWithFile:[NSString stringWithUTF8String:file] function:function line:line message:[[NSString alloc] initWithFormat:format arguments:args] color:color];

my pod file

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'Example' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  # inherit! :search_paths
  pod 'CocoaDebug', :configurations => ['Debug', 'Local'], :git => 'https://github.com/CocoaDebug/CocoaDebug', :submodules => true
end

defined constants are just the same as example in the README

#ifdef DEBUG
    #define NSLog(fmt, ...) [CocoaDebug objcLog:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] :NSStringFromSelector(_cmd) :__LINE__ :(fmt, ##__VA_ARGS__) :[UIColor whiteColor]]
#else
    #define NSLog(fmt, ...) nil
#endif

Status bar color is black

CocoaDebug设置为enable后,App 的Status bar color就会被设置成黑色(原来是白色)。

PR #12 bug fix

HI,
I did a PR a few days ago and a bug has been found in iOS 10 and below.

And I want to actually use Swift.print or NSLog in the app in the log section,
and use the part of CocoaDebug that is shown in LogViewController separately.

IJKMediaPlayer Compatibility problems

我们有一个页面使用了IJKMediaPlayer作为播放器内核,当我们导入CocoaDebug后,即便不enable,也会导致该页面出现操控问题(拖动不正常,播放完成后,返回按钮不可点击)。我们目前还在排查是IJKMediaPlayer的问题还是我们自己代码的问题。

Swift 4.2

Any plan for compiling with Xcode 10?

No report of message

capture d ecran 2018-04-17 a 22 02 03

capture d ecran 2018-04-17 a 22 02 19

I don't have my report of my error.

This is my code

        #if DEBUG
            let description = "\n[\(reportType.logo())]\n👉\(error)\n👈"
            let color: UIColor
            switch reportType {
            case .error:    color = UIColor.red
            case .warning:  color = UIColor.orange
            case .info:     color = UIColor.yellow
            }
            swiftLog(file, function, inLine, description, color)
        #endif

do you need some more information ?

iOS 13 issue

When using CocoaDebug in iOS 13 simulator.

  1. tap bubble will open CocoaDebug Controller
  2. Close CocoaDebug

App window cannot receive events.

Memory Leak when use MLeaksFinder

问题:项目中同时集成MLeaksFinder, 打开CocoaDebug的"SandBox"页面, 点击左上角关闭, MLeaksFinder报Memory Leak.

原因:经检查, 关闭后, SandboxViewController控制器仍然被Sandbox的单例对象持有, 导致无法被正常销毁.

解决:Sandbox的homeDirectoryNavigationController方法每次返回新的UINavigationController.

- (UINavigationController *)homeDirectoryNavigationController {
    SandboxViewController *sandboxViewController = [[SandboxViewController alloc] init];
    sandboxViewController.homeDirectory = YES;
    sandboxViewController.fileInfo = [[MLBFileInfo alloc] initWithFileURL:self.homeFileURL];
    UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:sandboxViewController];
    return navi;
}

CustomProtocol has memory leaks

image

There is my Leaks's Logs with my app running in 30s:

416 Bytes    1.3%	4	 	+[UIWebView(BlocksKit) load]

11.56 KB 39.3% 7 -[CustomProtocol URLSession:dataTask:didReceiveData:]
15.97 KB 54.3% 123 -[CustomProtocol startLoading]

No such module 'CocoaDebug' in different build configurtion

I have 3 different build configuration

image

Beta is basically the same as debug but with some differences: API, app name and such.
for each config there is a scheme. So when I switch to to Beta scheme I get this error:

No such module 'CocoaDebug'

in

#if DEBUG
    import CocoaDebug
#endif

[<UIViewController> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key deleteItem

on double clicking the bubble

(
	0   CoreFoundation                      0x000000010ca4f6fb __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x000000010bb3bac5 objc_exception_throw + 48
	2   CoreFoundation                      0x000000010ca4f269 -[NSException raise] + 9
	3   Foundation                          0x000000010a919562 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 289
	4   UIKitCore                           0x000000011d2472d2 -[UIViewController setValue:forKey:] + 87
	5   UIKitCore                           0x000000011d4d48fd -[UIRuntimeOutletConnection connect] + 109
	6   CoreFoundation                      0x000000010ca3bd41 -[NSArray makeObjectsPerformSelector:] + 305
	7   UIKitCore                           0x000000011d4d1643 -[UINib instantiateWithOwner:options:] + 1810
	8   UIKitCore                           0x000000011d9e9c60 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 181
	9   flightMakerIOS                      0x00000001082d9aa3 $s10CocoaDebug0aB16TabBarControllerC19setChildControllersyyF + 467
	10  flightMakerIOS                      0x00000001082d8c2c $s10CocoaDebug0aB16TabBarControllerC11viewDidLoadyyF + 716
	11  flightMakerIOS                      0x00000001082d8e34 $s10CocoaDebug0aB16TabBarControllerC11viewDidLoadyyFTo + 36
	12  UIKitCore                           0x000000011d24f43b -[UIViewController loadViewIfRequired] + 1183
	13  UIKitCore                           0x000000011d24f868 -[UIViewController view] + 27
	14  UIKitCore                           0x000000011d1770fc -[_UIFullscreenPresentationController _setPresentedViewController:] + 89
	15  UIKitCore                           0x000000011d16b1f2 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 133
	16  UIKitCore                           0x000000011d2624ce -[UIViewController _presentViewController:withAnimationController:completion:] + 3700
	17  UIKitCore                           0x000000011d26511b __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 98
	18  UIKitCore                           0x000000011d265633 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 511
	19  UIKitCore                           0x000000011d265082 -[UIViewController _presentViewController:animated:completion:] + 172
	20  UIKitCore                           0x000000011d2652e0 -[UIViewController presentViewController:animated:completion:] + 150
	21  flightMakerIOS                      0x00000001082dd96e $s10CocoaDebug0aB14ViewControllerC12didTapBubbleyyF + 398
	22  flightMakerIOS                      0x00000001082dd9c9 $s10CocoaDebug0aB14ViewControllerCAA14BubbleDelegateA2aDP06didTapE0yyFTW + 9
	23  flightMakerIOS                      0x00000001082be2b7 $s10CocoaDebug6BubbleC3tapyyF + 167
	24  flightMakerIOS                      0x00000001082be304 $s10CocoaDebug6BubbleC3tapyyFTo + 36
	25  UIKitCore                           0x000000011d43b14d -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 57
	26  UIKitCore                           0x000000011d443c69 _UIGestureRecognizerSendTargetActions + 109
	27  UIKitCore                           0x000000011d4415ba _UIGestureRecognizerSendActions + 311
	28  UIKitCore                           0x000000011d440897 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 966
	29  UIKitCore                           0x000000011d432c4e _UIGestureEnvironmentUpdate + 2820
	30  UIKitCore                           0x000000011d432108 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 478
	31  UIKitCore                           0x000000011d431e96 -[UIGestureEnvironment _updateForEvent:window:] + 200
	32  UIKitCore                           0x000000011d88d5bc -[UIWindow sendEvent:] + 4057
	33  UIKitCore                           0x000000011d86bd16 -[UIApplication sendEvent:] + 356
	34  UIKitCore                           0x000000011d93c293 __dispatchPreprocessedEventFromEventQueue + 3232
	35  UIKitCore                           0x000000011d93ebb9 __handleEventQueueInternal + 5911
	36  CoreFoundation                      0x000000010c9b6be1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
	37  CoreFoundation                      0x000000010c9b6463 __CFRunLoopDoSources0 + 243
	38  CoreFoundation                      0x000000010c9b0b1f __CFRunLoopRun + 1231
	39  CoreFoundation                      0x000000010c9b0302 CFRunLoopRunSpecific + 626
	40  GraphicsServices                    0x0000000113d372fe GSEventRunModal + 65
	41  UIKitCore                           0x000000011d851ba2 UIApplicationMain + 140
	42  flightMakerIOS                      0x0000000108213bbb main + 75
	43  libdyld.dylib                       0x0000000114fcd541 start + 1
	44  ???                                 0x0000000000000001 0x0 + 1
)

Web images can't display properly

2019-07-01 18:53:36.568810+0800 local_env[20397:321766] Task <3FDFAABF-21DE-4012-90EF-666E0387812D>.<135> load failed with error Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “.com” which could put your confidential information at risk." UserInfo={NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, NSErrorPeerCertificateChainKey=(
"<cert(0x7fcf431c9a00) s: .mrrck.com i: Encryption Everywhere DV TLS CA - G1>",
"<cert(0x7fcf4398a800) s: Encryption Everywhere DV TLS CA - G1 i: DigiCert Global Root CA>"
), NSErrorClientCertificateStateKey=0, NSErrorFailingURLKey=https://
/uploadFiles/2018-05-24/20180524102040316158.jpg, NSErrorFailingURLStringKey=https://
/uploadFiles/2018-05-24/20180524102040316158.jpg, NSUnderlyingError=0x600003f14180 {Error Domain=kCFErrorDomainCFNetwork Code=-1202 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x600000200990>, _kCFNetworkCFStreamSSLErrorOriginalValue=-9814, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9814, kCFStreamPropertySSLPeerCertificates=(
"<cert(0x7fcf431c9a00) s: .mrrck.com i: Encryption Everywhere DV TLS CA - G1>",
"<cert(0x7fcf4398a800) s: Encryption Everywhere DV TLS CA - G1 i: DigiCert Global Root CA>"
)}}, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <3FDFAABF-21DE-4012-90EF-666E0387812D>.<135>",
"LocalDataTask <90768F4A-1385-4326-944C-9CF11BB7C23C>.<154>"
), _kCFStreamErrorCodeKey=-9814, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <3FDFAABF-21DE-4012-90EF-666E0387812D>.<135>, NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x600000200990>, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “
.com” which could put your confidential information at risk.} [-1202]

UrlSession willPerformHTTPRedirection failed when import module

Hi,

when import the module CocoaDebug in the project, the delegate method willPerformHTTPRedirection of URLSessionTaskDelegate never called, but if we remove the module (remove completely from the project not only remove import) the method was called correctly.

This behavior only manifested using URLSessionConfiguration.default, but from version 0.2.3 also with URLSessionConfiguration.ephemeral

In attached, a sample project that reproduces the problem.
DemoRedirect.zip

Thanks
Marco

Filter bugs

Hi, im using this library and running in iphone 7, but i can not filter my post because the text field show in nav bar.
img_0707

Can you optimize your UI

the icons and the black theme is not suitable for all application , can you provide some custom options for the interface

Logging isn't working

I implemented the Swift print function as described in the readme but the logging isn't coming into the debug man logger. Using swift 4.

Issue with Podfile

When I try to install Podfile, it's showing warning.. Unable to find a pod with name, author, summary, or description matching `CocoaDebug. Please help me in this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.