Skip to content

ANRDetector - is a simple framework for detecting cases when application is not responsive.

Notifications You must be signed in to change notification settings

protspace/YESAnrDetector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

YESAnrDetector

Test coverage Twitter: @protspace

ANRDetector - is a simple framework for detecting cases when application is not responsive (Main thread is blocked). Using a timer it measures how much time was spend on a test operation. It notifies about changes within delegate pattern.

Usage

  1. Drag-and-drop Framework/ANRDetector.framework to your project. Make sure it is present under ‘Link binary with libraries” section in Build Phases of your project.
  2. Import ANRDetector in your class
import ANRDetector
  1. Implement delegate methods (if needed)
extension YourClass: ANRDetectorDelegate {

        func didDetectANR() {
            print("⛔️ ANR DETECTED")
        }

        func didBackToNormal(anrDuration: TimeInterval) {
            print("✅ Back to normal. ANR duration: \(anrDuration) sec.")
        }
}

Problems/difficulties I’ve met:

  1. The ANR duration time calculated is not very precise - this could be improved.
  2. Preparing universal framework that supports x86_64 / arm64 (lipo). I wish there were simple checkbox for this.

About

ANRDetector - is a simple framework for detecting cases when application is not responsive.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages