├── .gitignore ├── Example ├── KillBug.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── KillBug-Example.xcscheme ├── KillBug │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── KBViewController.h │ ├── KBViewController.m │ ├── KillBug-Info.plist │ ├── KillBug-Prefix.pch │ ├── UIAppDelegate.h │ ├── UIAppDelegate.m │ ├── en.lproj │ │ └── InfoPlist.strings │ └── main.m ├── Podfile └── Tests │ ├── Tests-Info.plist │ ├── Tests-Prefix.pch │ ├── Tests.m │ └── en.lproj │ └── InfoPlist.strings ├── KillBug.podspec ├── KillBug ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ ├── Core │ ├── KBSwizzler.h │ ├── KBSwizzler.m │ ├── KBTrackConfig.h │ ├── KBTrackConfig.m │ ├── KBUIApplicationEvents.h │ ├── KBUIApplicationEvents.m │ ├── NSObject+KBSwizzle.h │ └── NSObject+KBSwizzle.m │ ├── Manager │ ├── KBAutoTrackManager.h │ └── KBAutoTrackManager.m │ └── UI │ ├── UIApplication+KBAutoTrack.h │ ├── UIApplication+KBAutoTrack.m │ ├── UIView+KBAutoTrack.h │ ├── UIView+KBAutoTrack.m │ ├── UIViewController+KBAutoTrack.h │ └── UIViewController+KBAutoTrack.m ├── LICENSE ├── README.md ├── _Pods.xcodeproj ├── logo.png └── publish.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | # CocoaPods 34 | # 35 | # We recommend against adding the Pods directory to your .gitignore. However 36 | # you should judge for yourself, the pros and cons are mentioned at: 37 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 38 | # 39 | # Pods/ 40 | # 41 | # Add this line if you want to avoid checking in source code from the Xcode workspace 42 | # *.xcworkspace 43 | 44 | # Carthage 45 | # 46 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 47 | # Carthage/Checkouts 48 | 49 | Carthage/Build/ 50 | 51 | # fastlane 52 | # 53 | # It is recommended to not store the screenshots in the git repo. 54 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 55 | # For more information about the recommended setup visit: 56 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 57 | 58 | fastlane/report.xml 59 | fastlane/Preview.html 60 | fastlane/screenshots/**/*.png 61 | fastlane/test_output 62 | 63 | # Code Injection 64 | # 65 | # After new code Injection tools there's a generated folder /iOSInjectionProject 66 | # https://github.com/johnno1962/injectionforxcode 67 | 68 | iOSInjectionProject/ 69 | -------------------------------------------------------------------------------- /Example/KillBug.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 11 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; 12 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; 13 | 6003F598195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F596195388D20070C39A /* InfoPlist.strings */; }; 14 | 6003F59A195388D20070C39A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F599195388D20070C39A /* main.m */; }; 15 | 6003F59E195388D20070C39A /* UIAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F59D195388D20070C39A /* UIAppDelegate.m */; }; 16 | 6003F5A7195388D20070C39A /* KBViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5A6195388D20070C39A /* KBViewController.m */; }; 17 | 6003F5A9195388D20070C39A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; }; 18 | 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; }; 19 | 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 20 | 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; 21 | 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; }; 22 | 6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; }; 23 | 71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */; }; 24 | 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; }; 25 | 99EC5D04166F4E0DFCC434BB /* Pods_KillBug_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3866E344DE4E9AF6BCC63825 /* Pods_KillBug_Tests.framework */; }; 26 | 9D666D633B0FA6F863DB8118 /* Pods_KillBug_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 252B8531ABB09FAA06160B4E /* Pods_KillBug_Example.framework */; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXContainerItemProxy section */ 30 | 6003F5B3195388D20070C39A /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 6003F582195388D10070C39A /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 6003F589195388D20070C39A; 35 | remoteInfo = KillBug; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 1D001EF89FB8BA83A2B00687 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 41 | 252B8531ABB09FAA06160B4E /* Pods_KillBug_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_KillBug_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 2FA233C75127CC1E738E6619 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 43 | 3866E344DE4E9AF6BCC63825 /* Pods_KillBug_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_KillBug_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 5362B25F58AB11C797AE7683 /* Pods-KillBug_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KillBug_Example.release.xcconfig"; path = "Target Support Files/Pods-KillBug_Example/Pods-KillBug_Example.release.xcconfig"; sourceTree = ""; }; 45 | 6003F58A195388D20070C39A /* KillBug_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KillBug_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 47 | 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 48 | 6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 49 | 6003F595195388D20070C39A /* KillBug-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "KillBug-Info.plist"; sourceTree = ""; }; 50 | 6003F597195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 51 | 6003F599195388D20070C39A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | 6003F59B195388D20070C39A /* KillBug-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KillBug-Prefix.pch"; sourceTree = ""; }; 53 | 6003F59C195388D20070C39A /* UIAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIAppDelegate.h; sourceTree = ""; }; 54 | 6003F59D195388D20070C39A /* UIAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIAppDelegate.m; sourceTree = ""; }; 55 | 6003F5A5195388D20070C39A /* KBViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBViewController.h; sourceTree = ""; }; 56 | 6003F5A6195388D20070C39A /* KBViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBViewController.m; sourceTree = ""; }; 57 | 6003F5A8195388D20070C39A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 58 | 6003F5AE195388D20070C39A /* KillBug_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KillBug_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | 6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 60 | 6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = ""; }; 61 | 6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 62 | 6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = ""; }; 63 | 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = ""; }; 64 | 71719F9E1E33DC2100824A3D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 65 | 758BAC8FD67E3535595995AC /* Pods-KillBug_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KillBug_Example.debug.xcconfig"; path = "Target Support Files/Pods-KillBug_Example/Pods-KillBug_Example.debug.xcconfig"; sourceTree = ""; }; 66 | 78E28E43F02ADC17619592A2 /* KillBug.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = KillBug.podspec; path = ../KillBug.podspec; sourceTree = ""; }; 67 | 7F5743A919C136AB84C1989E /* Pods-KillBug_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KillBug_Tests.debug.xcconfig"; path = "Target Support Files/Pods-KillBug_Tests/Pods-KillBug_Tests.debug.xcconfig"; sourceTree = ""; }; 68 | 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 69 | CF1A8C622FF37F0345043882 /* Pods-KillBug_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KillBug_Tests.release.xcconfig"; path = "Target Support Files/Pods-KillBug_Tests/Pods-KillBug_Tests.release.xcconfig"; sourceTree = ""; }; 70 | /* End PBXFileReference section */ 71 | 72 | /* Begin PBXFrameworksBuildPhase section */ 73 | 6003F587195388D20070C39A /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, 78 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, 79 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, 80 | 9D666D633B0FA6F863DB8118 /* Pods_KillBug_Example.framework in Frameworks */, 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | 6003F5AB195388D20070C39A /* Frameworks */ = { 85 | isa = PBXFrameworksBuildPhase; 86 | buildActionMask = 2147483647; 87 | files = ( 88 | 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */, 89 | 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */, 90 | 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */, 91 | 99EC5D04166F4E0DFCC434BB /* Pods_KillBug_Tests.framework in Frameworks */, 92 | ); 93 | runOnlyForDeploymentPostprocessing = 0; 94 | }; 95 | /* End PBXFrameworksBuildPhase section */ 96 | 97 | /* Begin PBXGroup section */ 98 | 6003F581195388D10070C39A = { 99 | isa = PBXGroup; 100 | children = ( 101 | 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */, 102 | 6003F593195388D20070C39A /* Example for KillBug */, 103 | 6003F5B5195388D20070C39A /* Tests */, 104 | 6003F58C195388D20070C39A /* Frameworks */, 105 | 6003F58B195388D20070C39A /* Products */, 106 | 89131AE5D92442D38FFF0AD3 /* Pods */, 107 | ); 108 | sourceTree = ""; 109 | }; 110 | 6003F58B195388D20070C39A /* Products */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 6003F58A195388D20070C39A /* KillBug_Example.app */, 114 | 6003F5AE195388D20070C39A /* KillBug_Tests.xctest */, 115 | ); 116 | name = Products; 117 | sourceTree = ""; 118 | }; 119 | 6003F58C195388D20070C39A /* Frameworks */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 6003F58D195388D20070C39A /* Foundation.framework */, 123 | 6003F58F195388D20070C39A /* CoreGraphics.framework */, 124 | 6003F591195388D20070C39A /* UIKit.framework */, 125 | 6003F5AF195388D20070C39A /* XCTest.framework */, 126 | 252B8531ABB09FAA06160B4E /* Pods_KillBug_Example.framework */, 127 | 3866E344DE4E9AF6BCC63825 /* Pods_KillBug_Tests.framework */, 128 | ); 129 | name = Frameworks; 130 | sourceTree = ""; 131 | }; 132 | 6003F593195388D20070C39A /* Example for KillBug */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 6003F59C195388D20070C39A /* UIAppDelegate.h */, 136 | 6003F59D195388D20070C39A /* UIAppDelegate.m */, 137 | 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */, 138 | 6003F5A5195388D20070C39A /* KBViewController.h */, 139 | 6003F5A6195388D20070C39A /* KBViewController.m */, 140 | 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */, 141 | 6003F5A8195388D20070C39A /* Images.xcassets */, 142 | 6003F594195388D20070C39A /* Supporting Files */, 143 | ); 144 | name = "Example for KillBug"; 145 | path = KillBug; 146 | sourceTree = ""; 147 | }; 148 | 6003F594195388D20070C39A /* Supporting Files */ = { 149 | isa = PBXGroup; 150 | children = ( 151 | 6003F595195388D20070C39A /* KillBug-Info.plist */, 152 | 6003F596195388D20070C39A /* InfoPlist.strings */, 153 | 6003F599195388D20070C39A /* main.m */, 154 | 6003F59B195388D20070C39A /* KillBug-Prefix.pch */, 155 | ); 156 | name = "Supporting Files"; 157 | sourceTree = ""; 158 | }; 159 | 6003F5B5195388D20070C39A /* Tests */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | 6003F5BB195388D20070C39A /* Tests.m */, 163 | 6003F5B6195388D20070C39A /* Supporting Files */, 164 | ); 165 | path = Tests; 166 | sourceTree = ""; 167 | }; 168 | 6003F5B6195388D20070C39A /* Supporting Files */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | 6003F5B7195388D20070C39A /* Tests-Info.plist */, 172 | 6003F5B8195388D20070C39A /* InfoPlist.strings */, 173 | 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */, 174 | ); 175 | name = "Supporting Files"; 176 | sourceTree = ""; 177 | }; 178 | 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */ = { 179 | isa = PBXGroup; 180 | children = ( 181 | 78E28E43F02ADC17619592A2 /* KillBug.podspec */, 182 | 2FA233C75127CC1E738E6619 /* README.md */, 183 | 1D001EF89FB8BA83A2B00687 /* LICENSE */, 184 | ); 185 | name = "Podspec Metadata"; 186 | sourceTree = ""; 187 | }; 188 | 89131AE5D92442D38FFF0AD3 /* Pods */ = { 189 | isa = PBXGroup; 190 | children = ( 191 | 758BAC8FD67E3535595995AC /* Pods-KillBug_Example.debug.xcconfig */, 192 | 5362B25F58AB11C797AE7683 /* Pods-KillBug_Example.release.xcconfig */, 193 | 7F5743A919C136AB84C1989E /* Pods-KillBug_Tests.debug.xcconfig */, 194 | CF1A8C622FF37F0345043882 /* Pods-KillBug_Tests.release.xcconfig */, 195 | ); 196 | path = Pods; 197 | sourceTree = ""; 198 | }; 199 | /* End PBXGroup section */ 200 | 201 | /* Begin PBXNativeTarget section */ 202 | 6003F589195388D20070C39A /* KillBug_Example */ = { 203 | isa = PBXNativeTarget; 204 | buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "KillBug_Example" */; 205 | buildPhases = ( 206 | C4C689C65706309CC844826C /* [CP] Check Pods Manifest.lock */, 207 | 6003F586195388D20070C39A /* Sources */, 208 | 6003F587195388D20070C39A /* Frameworks */, 209 | 6003F588195388D20070C39A /* Resources */, 210 | 9A058F3DFD5CEDD5C479895C /* [CP] Embed Pods Frameworks */, 211 | ); 212 | buildRules = ( 213 | ); 214 | dependencies = ( 215 | ); 216 | name = KillBug_Example; 217 | productName = KillBug; 218 | productReference = 6003F58A195388D20070C39A /* KillBug_Example.app */; 219 | productType = "com.apple.product-type.application"; 220 | }; 221 | 6003F5AD195388D20070C39A /* KillBug_Tests */ = { 222 | isa = PBXNativeTarget; 223 | buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "KillBug_Tests" */; 224 | buildPhases = ( 225 | DEC9F80919DC082AD545C40A /* [CP] Check Pods Manifest.lock */, 226 | 6003F5AA195388D20070C39A /* Sources */, 227 | 6003F5AB195388D20070C39A /* Frameworks */, 228 | 6003F5AC195388D20070C39A /* Resources */, 229 | ); 230 | buildRules = ( 231 | ); 232 | dependencies = ( 233 | 6003F5B4195388D20070C39A /* PBXTargetDependency */, 234 | ); 235 | name = KillBug_Tests; 236 | productName = KillBugTests; 237 | productReference = 6003F5AE195388D20070C39A /* KillBug_Tests.xctest */; 238 | productType = "com.apple.product-type.bundle.unit-test"; 239 | }; 240 | /* End PBXNativeTarget section */ 241 | 242 | /* Begin PBXProject section */ 243 | 6003F582195388D10070C39A /* Project object */ = { 244 | isa = PBXProject; 245 | attributes = { 246 | CLASSPREFIX = KB; 247 | LastUpgradeCheck = 0720; 248 | ORGANIZATIONNAME = tliens; 249 | TargetAttributes = { 250 | 6003F589195388D20070C39A = { 251 | DevelopmentTeam = C4J8DR4YAQ; 252 | }; 253 | 6003F5AD195388D20070C39A = { 254 | TestTargetID = 6003F589195388D20070C39A; 255 | }; 256 | }; 257 | }; 258 | buildConfigurationList = 6003F585195388D10070C39A /* Build configuration list for PBXProject "KillBug" */; 259 | compatibilityVersion = "Xcode 3.2"; 260 | developmentRegion = English; 261 | hasScannedForEncodings = 0; 262 | knownRegions = ( 263 | English, 264 | en, 265 | Base, 266 | ); 267 | mainGroup = 6003F581195388D10070C39A; 268 | productRefGroup = 6003F58B195388D20070C39A /* Products */; 269 | projectDirPath = ""; 270 | projectRoot = ""; 271 | targets = ( 272 | 6003F589195388D20070C39A /* KillBug_Example */, 273 | 6003F5AD195388D20070C39A /* KillBug_Tests */, 274 | ); 275 | }; 276 | /* End PBXProject section */ 277 | 278 | /* Begin PBXResourcesBuildPhase section */ 279 | 6003F588195388D20070C39A /* Resources */ = { 280 | isa = PBXResourcesBuildPhase; 281 | buildActionMask = 2147483647; 282 | files = ( 283 | 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */, 284 | 71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */, 285 | 6003F5A9195388D20070C39A /* Images.xcassets in Resources */, 286 | 6003F598195388D20070C39A /* InfoPlist.strings in Resources */, 287 | ); 288 | runOnlyForDeploymentPostprocessing = 0; 289 | }; 290 | 6003F5AC195388D20070C39A /* Resources */ = { 291 | isa = PBXResourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */, 295 | ); 296 | runOnlyForDeploymentPostprocessing = 0; 297 | }; 298 | /* End PBXResourcesBuildPhase section */ 299 | 300 | /* Begin PBXShellScriptBuildPhase section */ 301 | 9A058F3DFD5CEDD5C479895C /* [CP] Embed Pods Frameworks */ = { 302 | isa = PBXShellScriptBuildPhase; 303 | buildActionMask = 2147483647; 304 | files = ( 305 | ); 306 | inputPaths = ( 307 | "${PODS_ROOT}/Target Support Files/Pods-KillBug_Example/Pods-KillBug_Example-frameworks.sh", 308 | "${BUILT_PRODUCTS_DIR}/KillBug/KillBug.framework", 309 | ); 310 | name = "[CP] Embed Pods Frameworks"; 311 | outputPaths = ( 312 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/KillBug.framework", 313 | ); 314 | runOnlyForDeploymentPostprocessing = 0; 315 | shellPath = /bin/sh; 316 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-KillBug_Example/Pods-KillBug_Example-frameworks.sh\"\n"; 317 | showEnvVarsInLog = 0; 318 | }; 319 | C4C689C65706309CC844826C /* [CP] Check Pods Manifest.lock */ = { 320 | isa = PBXShellScriptBuildPhase; 321 | buildActionMask = 2147483647; 322 | files = ( 323 | ); 324 | inputFileListPaths = ( 325 | ); 326 | inputPaths = ( 327 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 328 | "${PODS_ROOT}/Manifest.lock", 329 | ); 330 | name = "[CP] Check Pods Manifest.lock"; 331 | outputFileListPaths = ( 332 | ); 333 | outputPaths = ( 334 | "$(DERIVED_FILE_DIR)/Pods-KillBug_Example-checkManifestLockResult.txt", 335 | ); 336 | runOnlyForDeploymentPostprocessing = 0; 337 | shellPath = /bin/sh; 338 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 339 | showEnvVarsInLog = 0; 340 | }; 341 | DEC9F80919DC082AD545C40A /* [CP] Check Pods Manifest.lock */ = { 342 | isa = PBXShellScriptBuildPhase; 343 | buildActionMask = 2147483647; 344 | files = ( 345 | ); 346 | inputFileListPaths = ( 347 | ); 348 | inputPaths = ( 349 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 350 | "${PODS_ROOT}/Manifest.lock", 351 | ); 352 | name = "[CP] Check Pods Manifest.lock"; 353 | outputFileListPaths = ( 354 | ); 355 | outputPaths = ( 356 | "$(DERIVED_FILE_DIR)/Pods-KillBug_Tests-checkManifestLockResult.txt", 357 | ); 358 | runOnlyForDeploymentPostprocessing = 0; 359 | shellPath = /bin/sh; 360 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 361 | showEnvVarsInLog = 0; 362 | }; 363 | /* End PBXShellScriptBuildPhase section */ 364 | 365 | /* Begin PBXSourcesBuildPhase section */ 366 | 6003F586195388D20070C39A /* Sources */ = { 367 | isa = PBXSourcesBuildPhase; 368 | buildActionMask = 2147483647; 369 | files = ( 370 | 6003F59E195388D20070C39A /* UIAppDelegate.m in Sources */, 371 | 6003F5A7195388D20070C39A /* KBViewController.m in Sources */, 372 | 6003F59A195388D20070C39A /* main.m in Sources */, 373 | ); 374 | runOnlyForDeploymentPostprocessing = 0; 375 | }; 376 | 6003F5AA195388D20070C39A /* Sources */ = { 377 | isa = PBXSourcesBuildPhase; 378 | buildActionMask = 2147483647; 379 | files = ( 380 | 6003F5BC195388D20070C39A /* Tests.m in Sources */, 381 | ); 382 | runOnlyForDeploymentPostprocessing = 0; 383 | }; 384 | /* End PBXSourcesBuildPhase section */ 385 | 386 | /* Begin PBXTargetDependency section */ 387 | 6003F5B4195388D20070C39A /* PBXTargetDependency */ = { 388 | isa = PBXTargetDependency; 389 | target = 6003F589195388D20070C39A /* KillBug_Example */; 390 | targetProxy = 6003F5B3195388D20070C39A /* PBXContainerItemProxy */; 391 | }; 392 | /* End PBXTargetDependency section */ 393 | 394 | /* Begin PBXVariantGroup section */ 395 | 6003F596195388D20070C39A /* InfoPlist.strings */ = { 396 | isa = PBXVariantGroup; 397 | children = ( 398 | 6003F597195388D20070C39A /* en */, 399 | ); 400 | name = InfoPlist.strings; 401 | sourceTree = ""; 402 | }; 403 | 6003F5B8195388D20070C39A /* InfoPlist.strings */ = { 404 | isa = PBXVariantGroup; 405 | children = ( 406 | 6003F5B9195388D20070C39A /* en */, 407 | ); 408 | name = InfoPlist.strings; 409 | sourceTree = ""; 410 | }; 411 | 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */ = { 412 | isa = PBXVariantGroup; 413 | children = ( 414 | 71719F9E1E33DC2100824A3D /* Base */, 415 | ); 416 | name = LaunchScreen.storyboard; 417 | sourceTree = ""; 418 | }; 419 | /* End PBXVariantGroup section */ 420 | 421 | /* Begin XCBuildConfiguration section */ 422 | 6003F5BD195388D20070C39A /* Debug */ = { 423 | isa = XCBuildConfiguration; 424 | buildSettings = { 425 | ALWAYS_SEARCH_USER_PATHS = NO; 426 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 427 | CLANG_CXX_LIBRARY = "libc++"; 428 | CLANG_ENABLE_MODULES = YES; 429 | CLANG_ENABLE_OBJC_ARC = YES; 430 | CLANG_WARN_BOOL_CONVERSION = YES; 431 | CLANG_WARN_CONSTANT_CONVERSION = YES; 432 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 433 | CLANG_WARN_EMPTY_BODY = YES; 434 | CLANG_WARN_ENUM_CONVERSION = YES; 435 | CLANG_WARN_INT_CONVERSION = YES; 436 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 437 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 438 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 439 | COPY_PHASE_STRIP = NO; 440 | ENABLE_TESTABILITY = YES; 441 | GCC_C_LANGUAGE_STANDARD = gnu99; 442 | GCC_DYNAMIC_NO_PIC = NO; 443 | GCC_OPTIMIZATION_LEVEL = 0; 444 | GCC_PREPROCESSOR_DEFINITIONS = ( 445 | "DEBUG=1", 446 | "$(inherited)", 447 | ); 448 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 449 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 450 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 451 | GCC_WARN_UNDECLARED_SELECTOR = YES; 452 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 453 | GCC_WARN_UNUSED_FUNCTION = YES; 454 | GCC_WARN_UNUSED_VARIABLE = YES; 455 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 456 | ONLY_ACTIVE_ARCH = YES; 457 | SDKROOT = iphoneos; 458 | TARGETED_DEVICE_FAMILY = "1,2"; 459 | }; 460 | name = Debug; 461 | }; 462 | 6003F5BE195388D20070C39A /* Release */ = { 463 | isa = XCBuildConfiguration; 464 | buildSettings = { 465 | ALWAYS_SEARCH_USER_PATHS = NO; 466 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 467 | CLANG_CXX_LIBRARY = "libc++"; 468 | CLANG_ENABLE_MODULES = YES; 469 | CLANG_ENABLE_OBJC_ARC = YES; 470 | CLANG_WARN_BOOL_CONVERSION = YES; 471 | CLANG_WARN_CONSTANT_CONVERSION = YES; 472 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 473 | CLANG_WARN_EMPTY_BODY = YES; 474 | CLANG_WARN_ENUM_CONVERSION = YES; 475 | CLANG_WARN_INT_CONVERSION = YES; 476 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 477 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 478 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 479 | COPY_PHASE_STRIP = YES; 480 | ENABLE_NS_ASSERTIONS = NO; 481 | GCC_C_LANGUAGE_STANDARD = gnu99; 482 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 483 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 484 | GCC_WARN_UNDECLARED_SELECTOR = YES; 485 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 486 | GCC_WARN_UNUSED_FUNCTION = YES; 487 | GCC_WARN_UNUSED_VARIABLE = YES; 488 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 489 | SDKROOT = iphoneos; 490 | TARGETED_DEVICE_FAMILY = "1,2"; 491 | VALIDATE_PRODUCT = YES; 492 | }; 493 | name = Release; 494 | }; 495 | 6003F5C0195388D20070C39A /* Debug */ = { 496 | isa = XCBuildConfiguration; 497 | baseConfigurationReference = 758BAC8FD67E3535595995AC /* Pods-KillBug_Example.debug.xcconfig */; 498 | buildSettings = { 499 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 500 | DEVELOPMENT_TEAM = C4J8DR4YAQ; 501 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 502 | GCC_PREFIX_HEADER = "KillBug/KillBug-Prefix.pch"; 503 | INFOPLIST_FILE = "KillBug/KillBug-Info.plist"; 504 | MODULE_NAME = ExampleApp; 505 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 506 | PRODUCT_NAME = "$(TARGET_NAME)"; 507 | SWIFT_VERSION = 4.0; 508 | WRAPPER_EXTENSION = app; 509 | }; 510 | name = Debug; 511 | }; 512 | 6003F5C1195388D20070C39A /* Release */ = { 513 | isa = XCBuildConfiguration; 514 | baseConfigurationReference = 5362B25F58AB11C797AE7683 /* Pods-KillBug_Example.release.xcconfig */; 515 | buildSettings = { 516 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 517 | DEVELOPMENT_TEAM = C4J8DR4YAQ; 518 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 519 | GCC_PREFIX_HEADER = "KillBug/KillBug-Prefix.pch"; 520 | INFOPLIST_FILE = "KillBug/KillBug-Info.plist"; 521 | MODULE_NAME = ExampleApp; 522 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 523 | PRODUCT_NAME = "$(TARGET_NAME)"; 524 | SWIFT_VERSION = 4.0; 525 | WRAPPER_EXTENSION = app; 526 | }; 527 | name = Release; 528 | }; 529 | 6003F5C3195388D20070C39A /* Debug */ = { 530 | isa = XCBuildConfiguration; 531 | baseConfigurationReference = 7F5743A919C136AB84C1989E /* Pods-KillBug_Tests.debug.xcconfig */; 532 | buildSettings = { 533 | BUNDLE_LOADER = "$(TEST_HOST)"; 534 | FRAMEWORK_SEARCH_PATHS = ( 535 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 536 | "$(inherited)", 537 | "$(DEVELOPER_FRAMEWORKS_DIR)", 538 | ); 539 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 540 | GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; 541 | GCC_PREPROCESSOR_DEFINITIONS = ( 542 | "DEBUG=1", 543 | "$(inherited)", 544 | ); 545 | INFOPLIST_FILE = "Tests/Tests-Info.plist"; 546 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 547 | PRODUCT_NAME = "$(TARGET_NAME)"; 548 | SWIFT_VERSION = 4.0; 549 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/KillBug_Example.app/KillBug_Example"; 550 | WRAPPER_EXTENSION = xctest; 551 | }; 552 | name = Debug; 553 | }; 554 | 6003F5C4195388D20070C39A /* Release */ = { 555 | isa = XCBuildConfiguration; 556 | baseConfigurationReference = CF1A8C622FF37F0345043882 /* Pods-KillBug_Tests.release.xcconfig */; 557 | buildSettings = { 558 | BUNDLE_LOADER = "$(TEST_HOST)"; 559 | FRAMEWORK_SEARCH_PATHS = ( 560 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 561 | "$(inherited)", 562 | "$(DEVELOPER_FRAMEWORKS_DIR)", 563 | ); 564 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 565 | GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; 566 | INFOPLIST_FILE = "Tests/Tests-Info.plist"; 567 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 568 | PRODUCT_NAME = "$(TARGET_NAME)"; 569 | SWIFT_VERSION = 4.0; 570 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/KillBug_Example.app/KillBug_Example"; 571 | WRAPPER_EXTENSION = xctest; 572 | }; 573 | name = Release; 574 | }; 575 | /* End XCBuildConfiguration section */ 576 | 577 | /* Begin XCConfigurationList section */ 578 | 6003F585195388D10070C39A /* Build configuration list for PBXProject "KillBug" */ = { 579 | isa = XCConfigurationList; 580 | buildConfigurations = ( 581 | 6003F5BD195388D20070C39A /* Debug */, 582 | 6003F5BE195388D20070C39A /* Release */, 583 | ); 584 | defaultConfigurationIsVisible = 0; 585 | defaultConfigurationName = Release; 586 | }; 587 | 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "KillBug_Example" */ = { 588 | isa = XCConfigurationList; 589 | buildConfigurations = ( 590 | 6003F5C0195388D20070C39A /* Debug */, 591 | 6003F5C1195388D20070C39A /* Release */, 592 | ); 593 | defaultConfigurationIsVisible = 0; 594 | defaultConfigurationName = Release; 595 | }; 596 | 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "KillBug_Tests" */ = { 597 | isa = XCConfigurationList; 598 | buildConfigurations = ( 599 | 6003F5C3195388D20070C39A /* Debug */, 600 | 6003F5C4195388D20070C39A /* Release */, 601 | ); 602 | defaultConfigurationIsVisible = 0; 603 | defaultConfigurationName = Release; 604 | }; 605 | /* End XCConfigurationList section */ 606 | }; 607 | rootObject = 6003F582195388D10070C39A /* Project object */; 608 | } 609 | -------------------------------------------------------------------------------- /Example/KillBug.xcodeproj/xcshareddata/xcschemes/KillBug-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /Example/KillBug/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Example/KillBug/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 30 | 35 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /Example/KillBug/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Example/KillBug/KBViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // KBViewController.h 3 | // KillBug 4 | // 5 | // Created by tliens on 03/29/2021. 6 | // Copyright (c) 2021 tliens. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface KBViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/KillBug/KBViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // KBViewController.m 3 | // KillBug 4 | // 5 | // Created by tliens on 03/29/2021. 6 | // Copyright (c) 2021 tliens. All rights reserved. 7 | // 8 | 9 | #import "KBViewController.h" 10 | 11 | @interface KBViewControllerA:UIViewController 12 | 13 | @end 14 | 15 | @interface KBViewController () 16 | 17 | @end 18 | 19 | @implementation KBViewController 20 | 21 | - (void)viewDidLoad 22 | { 23 | [super viewDidLoad]; 24 | // Do any additional setup after loading the view, typically from a nib. 25 | 26 | UIButton *btn1 = [[UIButton alloc] initWithFrame:CGRectMake(0, 430, 100, 100)]; 27 | [btn1 setTitle:@"小明" forState:(UIControlStateNormal)]; 28 | btn1.backgroundColor = [UIColor redColor]; 29 | [self.view addSubview:btn1]; 30 | 31 | [btn1 addTarget:self action:@selector(btn1Action:) forControlEvents:(UIControlEventTouchUpInside)]; 32 | } 33 | - (void) btn1Action:(UIButton*)btn{ 34 | 35 | } 36 | - (void)didReceiveMemoryWarning 37 | { 38 | [super didReceiveMemoryWarning]; 39 | // Dispose of any resources that can be recreated. 40 | } 41 | - (IBAction)btnAAction:(id)sender { 42 | 43 | } 44 | - (IBAction)manualCrash:(id)sender { 45 | NSArray *arr = @[@0]; 46 | arr[1]; 47 | } 48 | 49 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ 50 | KBViewControllerA *vc = [[KBViewControllerA alloc] init]; 51 | vc.modalPresentationStyle = UIModalPresentationFullScreen; 52 | [self presentViewController:vc animated:true completion:nil]; 53 | } 54 | @end 55 | 56 | 57 | @implementation KBViewControllerA 58 | 59 | - (void)viewDidLoad 60 | { 61 | [super viewDidLoad]; 62 | // Do any additional setup after loading the view, typically from a nib. 63 | self.view.backgroundColor = [UIColor yellowColor]; 64 | 65 | UITableView *tableview = [[UITableView alloc] initWithFrame:CGRectMake(0, 100, 300, 400)]; 66 | [tableview registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"]; 67 | [self.view addSubview:tableview]; 68 | 69 | tableview.delegate = self; 70 | tableview.dataSource = self; 71 | } 72 | 73 | - (void)didReceiveMemoryWarning 74 | { 75 | [super didReceiveMemoryWarning]; 76 | // Dispose of any resources that can be recreated. 77 | } 78 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ 79 | [self dismissViewControllerAnimated:true completion:nil]; 80 | } 81 | 82 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 83 | 84 | UITableViewCell *c = [tableView dequeueReusableCellWithIdentifier:@"cell"]; 85 | c.textLabel.text = @"😁"; 86 | c.backgroundColor = [UIColor blueColor]; 87 | return c; 88 | } 89 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 90 | return 20; 91 | } 92 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ 93 | return 40; 94 | } 95 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 96 | 97 | } 98 | @end 99 | -------------------------------------------------------------------------------- /Example/KillBug/KillBug-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Example/KillBug/KillBug-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | @import UIKit; 15 | @import Foundation; 16 | #endif 17 | -------------------------------------------------------------------------------- /Example/KillBug/UIAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // KBAppDelegate.h 3 | // KillBug 4 | // 5 | // Created by tliens on 03/29/2021. 6 | // Copyright (c) 2021 tliens. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface UIAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/KillBug/UIAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // KBAppDelegate.m 3 | // KillBug 4 | // 5 | // Created by tliens on 03/29/2021. 6 | // Copyright (c) 2021 tliens. All rights reserved. 7 | // 8 | 9 | #import "UIAppDelegate.h" 10 | #import 11 | 12 | @implementation UIAppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | // Override point for customization after application launch. 17 | KBAutoTrackManager *manager = [KBAutoTrackManager shared]; 18 | [manager debugInfoHandler:^(NSString * _Nonnull info) { 19 | NSLog(@"%@", info); 20 | /// Custom 21 | }]; 22 | return YES; 23 | } 24 | 25 | - (void)applicationWillResignActive:(UIApplication *)application 26 | { 27 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 28 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 29 | } 30 | 31 | - (void)applicationDidEnterBackground:(UIApplication *)application 32 | { 33 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 34 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 35 | } 36 | 37 | - (void)applicationWillEnterForeground:(UIApplication *)application 38 | { 39 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 40 | } 41 | 42 | - (void)applicationDidBecomeActive:(UIApplication *)application 43 | { 44 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 45 | } 46 | 47 | - (void)applicationWillTerminate:(UIApplication *)application 48 | { 49 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Example/KillBug/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/KillBug/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // KillBug 4 | // 5 | // Created by tliens on 03/29/2021. 6 | // Copyright (c) 2021 tliens. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | #import "UIAppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) 13 | { 14 | @autoreleasepool { 15 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([UIAppDelegate class])); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | platform :ios, '9.0' 4 | 5 | target 'KillBug_Example' do 6 | pod 'KillBug', :path => '../' 7 | 8 | target 'KillBug_Tests' do 9 | inherit! :search_paths 10 | 11 | 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // The contents of this file are implicitly included at the beginning of every test case source file. 2 | 3 | #ifdef __OBJC__ 4 | 5 | 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /Example/Tests/Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // KillBugTests.m 3 | // KillBugTests 4 | // 5 | // Created by tliens on 03/29/2021. 6 | // Copyright (c) 2021 tliens. All rights reserved. 7 | // 8 | 9 | @import XCTest; 10 | 11 | @interface Tests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation Tests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | 36 | -------------------------------------------------------------------------------- /Example/Tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /KillBug.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint KillBug.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'KillBug' 11 | s.version = '0.1.1' 12 | s.summary = '用户操作自动监测工具' 13 | 14 | # This description is used to generate tags and improve search results. 15 | # * Think: What does it do? Why did you write it? What is the focus? 16 | # * Try to keep it short, snappy and to the point. 17 | # * Write the description between the DESC delimiters below. 18 | # * Finally, don't worry about the indent, CocoaPods strips it! 19 | 20 | s.description = <<-DESC 21 | TODO: Add long description of the pod here. 22 | DESC 23 | 24 | s.homepage = 'https://github.com/tliens/KillBug' 25 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' 26 | s.license = { :type => 'MIT', :file => 'LICENSE' } 27 | s.author = { 'tliens' => 'maninios@163.com' } 28 | s.source = { :git => 'https://github.com/tliens/KillBug.git', :tag => s.version.to_s } 29 | # s.social_media_url = 'https://twitter.com/' 30 | 31 | s.ios.deployment_target = '9.0' 32 | 33 | s.source_files = 'KillBug/Classes/**/*' 34 | 35 | # s.resource_bundles = { 36 | # 'KillBug' => ['KillBug/Assets/*.png'] 37 | # } 38 | 39 | # s.public_header_files = 'Pod/Classes/**/*.h' 40 | # s.frameworks = 'UIKit', 'MapKit' 41 | # s.dependency 'AFNetworking', '~> 2.3' 42 | end 43 | -------------------------------------------------------------------------------- /KillBug/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tliens/KillBug/683da9e700652453d01838304d87106c92ad58bc/KillBug/Assets/.gitkeep -------------------------------------------------------------------------------- /KillBug/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tliens/KillBug/683da9e700652453d01838304d87106c92ad58bc/KillBug/Classes/.gitkeep -------------------------------------------------------------------------------- /KillBug/Classes/Core/KBSwizzler.h: -------------------------------------------------------------------------------- 1 | // 2 | // KBSwizzler.h 3 | // KillBug 4 | // 5 | // Created by 2020 on 2021/3/29. 6 | // 7 | 8 | #pragma mark - 方法交换器 9 | 10 | #import 11 | /// 消除警告 12 | #pragma clang diagnostic push 13 | #pragma clang diagnostic ignored "-Wstrict-prototypes" 14 | typedef void (^swizzleBlock)(); 15 | #pragma clang diagnostic pop 16 | 17 | NS_ASSUME_NONNULL_BEGIN 18 | 19 | @interface KBSwizzler : NSObject 20 | + (void)swizzleSelector:(SEL)aSelector onClass:(Class)aClass withBlock:(swizzleBlock)block named:(NSString *)aName; 21 | + (void)unswizzleSelector:(SEL)aSelector onClass:(Class)aClass named:(NSString *)aName; 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /KillBug/Classes/Core/KBSwizzler.m: -------------------------------------------------------------------------------- 1 | // 2 | // KBSwizzle.m 3 | // KillBug 4 | // 5 | // Created by 2020 on 2021/3/29. 6 | // 7 | 8 | #import "KBSwizzler.h" 9 | #import 10 | #define MAPTABLE_ID(x) (__bridge id)((void *)x) 11 | 12 | #define MIN_ARGS 2 13 | #define MAX_ARGS 4 14 | @interface KBSwizzle:NSObject 15 | 16 | @property (nonatomic, assign) Class class; 17 | @property (nonatomic, assign) SEL selector; 18 | @property (nonatomic, assign) IMP originalMethod; 19 | @property (nonatomic, assign) uint numArgs; 20 | @property (nonatomic, copy) NSMapTable *blocks; 21 | 22 | - (instancetype)initWithBlock:(swizzleBlock)aBlock 23 | named:(NSString *)aName 24 | forClass:(Class)aClass 25 | selector:(SEL)aSelector 26 | originalMethod:(IMP)aMethod; 27 | 28 | @end 29 | 30 | static NSMapTable *swizzles; 31 | 32 | static void kb_swizzledMethod_2(id self, SEL _cmd) { 33 | Method aMethod = class_getInstanceMethod([self class], _cmd); 34 | KBSwizzle *swizzle = (KBSwizzle *)[swizzles objectForKey:MAPTABLE_ID(aMethod)]; 35 | if (swizzle) { 36 | ((void(*)(id, SEL))swizzle.originalMethod)(self, _cmd); 37 | 38 | NSEnumerator *blocks = [swizzle.blocks objectEnumerator]; 39 | swizzleBlock block; 40 | while((block = [blocks nextObject])) { 41 | 42 | block(self, _cmd); 43 | } 44 | } 45 | } 46 | static void kb_swizzledMethod_3(id self, SEL _cmd, id arg) { 47 | Method aMethod = class_getInstanceMethod([self class], _cmd); 48 | KBSwizzle *swizzle = (KBSwizzle *)[swizzles objectForKey:MAPTABLE_ID(aMethod)]; 49 | if (swizzle) { 50 | ((void(*)(id, SEL, id))swizzle.originalMethod)(self, _cmd, arg); 51 | 52 | NSEnumerator *blocks = [swizzle.blocks objectEnumerator]; 53 | swizzleBlock block; 54 | while((block = [blocks nextObject])) { 55 | block(self, _cmd, arg); 56 | } 57 | } 58 | } 59 | 60 | static void kb_swizzledMethod_4(id self, SEL _cmd, id arg, id arg2) { 61 | Method aMethod = class_getInstanceMethod([self class], _cmd); 62 | KBSwizzle *swizzle = (KBSwizzle *)[swizzles objectForKey:(__bridge id)((void *)aMethod)]; 63 | if (swizzle) { 64 | ((void(*)(id, SEL, id, id))swizzle.originalMethod)(self, _cmd, arg, arg2); 65 | 66 | NSEnumerator *blocks = [swizzle.blocks objectEnumerator]; 67 | swizzleBlock block; 68 | while((block = [blocks nextObject])) { 69 | block(self, _cmd, arg, arg2); 70 | } 71 | } 72 | } 73 | 74 | #pragma clang diagnostic push 75 | #pragma clang diagnostic ignored "-Wstrict-prototypes" 76 | static void (*kb_swizzledMethods[MAX_ARGS - MIN_ARGS + 1])() = {kb_swizzledMethod_2, kb_swizzledMethod_3, kb_swizzledMethod_4}; 77 | #pragma clang diagnostic pop 78 | 79 | @implementation KBSwizzler 80 | 81 | + (void)load { 82 | swizzles = [NSMapTable mapTableWithKeyOptions:(NSPointerFunctionsOpaqueMemory | NSPointerFunctionsOpaquePersonality) 83 | valueOptions:(NSPointerFunctionsStrongMemory | NSPointerFunctionsObjectPointerPersonality)]; 84 | } 85 | 86 | + (KBSwizzle *)swizzleForMethod:(Method)aMethod { 87 | return (KBSwizzle *)[swizzles objectForKey:MAPTABLE_ID(aMethod)]; 88 | } 89 | 90 | + (void)removeSwizzleForMethod:(Method)aMethod { 91 | [swizzles removeObjectForKey:MAPTABLE_ID(aMethod)]; 92 | } 93 | 94 | + (void)setSwizzle:(KBSwizzle *)swizzle forMethod:(Method)aMethod { 95 | [swizzles setObject:swizzle forKey:MAPTABLE_ID(aMethod)]; 96 | } 97 | 98 | + (BOOL)isLocallyDefinedMethod:(Method)aMethod onClass:(Class)aClass { 99 | uint count; 100 | BOOL isLocal = NO; 101 | Method *methods = class_copyMethodList(aClass, &count); 102 | for (NSUInteger i = 0; i < count; i++) { 103 | if (aMethod == methods[i]) { 104 | isLocal = YES; 105 | break; 106 | } 107 | } 108 | free(methods); 109 | return isLocal; 110 | } 111 | 112 | + (void)swizzleSelector:(SEL)aSelector 113 | onClass:(Class)aClass 114 | withBlock:(swizzleBlock)aBlock 115 | named:(NSString *)aName { 116 | Method aMethod = class_getInstanceMethod(aClass, aSelector); 117 | if (!aMethod) { 118 | NSLog(@"SwizzleException:Cannot find method for %@ on %@",NSStringFromSelector(aSelector), NSStringFromClass(aClass)); 119 | return; 120 | } 121 | 122 | uint numArgs = method_getNumberOfArguments(aMethod); 123 | if (numArgs < MIN_ARGS || numArgs > MAX_ARGS) { 124 | NSLog(@"Cannot swizzle method with %d args", numArgs); 125 | } 126 | 127 | IMP swizzledMethod = (IMP)kb_swizzledMethods[numArgs - 2]; 128 | [KBSwizzler swizzleSelector:aSelector onClass:aClass withBlock:aBlock andSwizzleMethod:swizzledMethod named:aName]; 129 | } 130 | 131 | + (void)swizzleSelector:(SEL)aSelector 132 | onClass:(Class)aClass 133 | withBlock:(swizzleBlock)aBlock 134 | andSwizzleMethod:(IMP)aSwizzleMethod 135 | named:(NSString *)aName { 136 | Method aMethod = class_getInstanceMethod(aClass, aSelector); 137 | if (!aMethod) { 138 | NSLog(@"Cannot find method for %@ on %@", NSStringFromSelector(aSelector), NSStringFromClass(aClass)); 139 | } 140 | 141 | BOOL isLocal = [self isLocallyDefinedMethod:aMethod onClass:aClass]; 142 | KBSwizzle *swizzle = [self swizzleForMethod:aMethod]; 143 | 144 | if (isLocal) { 145 | if (!swizzle) { 146 | IMP originalMethod = method_getImplementation(aMethod); 147 | 148 | // Replace the local implementation of this method with the swizzled one 149 | method_setImplementation(aMethod, aSwizzleMethod); 150 | 151 | // Create and add the swizzle 152 | @try { 153 | swizzle = [[KBSwizzle alloc] initWithBlock:aBlock named:aName forClass:aClass selector:aSelector originalMethod:originalMethod]; 154 | } @catch (NSException *exception) { 155 | NSLog(@"%@ error: %@", self, exception); 156 | } 157 | [self setSwizzle:swizzle forMethod:aMethod]; 158 | } else { 159 | [swizzle.blocks setObject:aBlock forKey:aName]; 160 | } 161 | } else { 162 | IMP originalMethod = swizzle ? swizzle.originalMethod : method_getImplementation(aMethod); 163 | 164 | // Add the swizzle as a new local method on the class. 165 | if (!class_addMethod(aClass, aSelector, aSwizzleMethod, method_getTypeEncoding(aMethod))) { 166 | NSLog(@"Could not add swizzled for %@::%@, even though it didn't already exist locally", NSStringFromClass(aClass), NSStringFromSelector(aSelector)); 167 | } 168 | // Now re-get the Method, it should be the one we just added. 169 | Method newMethod = class_getInstanceMethod(aClass, aSelector); 170 | if (aMethod == newMethod) { 171 | NSLog(@"Newly added method for %@::%@ was the same as the old method", NSStringFromClass(aClass), NSStringFromSelector(aSelector)); 172 | } 173 | 174 | KBSwizzle *newSwizzle = [[KBSwizzle alloc] initWithBlock:aBlock named:aName forClass:aClass selector:aSelector originalMethod:originalMethod]; 175 | [self setSwizzle:newSwizzle forMethod:newMethod]; 176 | } 177 | } 178 | 179 | + (void)unswizzleSelector:(SEL)aSelector onClass:(Class)aClass { 180 | Method aMethod = class_getInstanceMethod(aClass, aSelector); 181 | KBSwizzle *swizzle = [self swizzleForMethod:aMethod]; 182 | if (swizzle) { 183 | method_setImplementation(aMethod, swizzle.originalMethod); 184 | [self removeSwizzleForMethod:aMethod]; 185 | } 186 | } 187 | 188 | /* 189 | Remove the named swizzle from the given class/selector. If aName is nil, remove all 190 | swizzles for this class/selector 191 | */ 192 | + (void)unswizzleSelector:(SEL)aSelector onClass:(Class)aClass named:(NSString *)aName { 193 | Method aMethod = class_getInstanceMethod(aClass, aSelector); 194 | KBSwizzle *swizzle = [self swizzleForMethod:aMethod]; 195 | if (swizzle) { 196 | if (aName) { 197 | [swizzle.blocks removeObjectForKey:aName]; 198 | } 199 | if (!aName || [swizzle.blocks count] == 0) { 200 | method_setImplementation(aMethod, swizzle.originalMethod); 201 | [self removeSwizzleForMethod:aMethod]; 202 | } 203 | } 204 | } 205 | 206 | @end 207 | 208 | 209 | @implementation KBSwizzle 210 | 211 | - (instancetype)init { 212 | if ((self = [super init])) { 213 | self.blocks = [NSMapTable mapTableWithKeyOptions:(NSPointerFunctionsStrongMemory | NSPointerFunctionsObjectPersonality) 214 | valueOptions:(NSPointerFunctionsStrongMemory | NSPointerFunctionsObjectPointerPersonality)]; 215 | } 216 | return self; 217 | } 218 | 219 | - (instancetype)initWithBlock:(swizzleBlock)aBlock 220 | named:(NSString *)aName 221 | forClass:(Class)aClass 222 | selector:(SEL)aSelector 223 | originalMethod:(IMP)aMethod { 224 | if ((self = [self init])) { 225 | self.class = aClass; 226 | self.selector = aSelector; 227 | self.originalMethod = aMethod; 228 | [self.blocks setObject:aBlock forKey:aName]; 229 | } 230 | return self; 231 | } 232 | 233 | - (NSString *)description { 234 | NSString *descriptors = @""; 235 | NSString *key; 236 | NSEnumerator *keys = [self.blocks keyEnumerator]; 237 | while ((key = [keys nextObject])) { 238 | descriptors = [descriptors stringByAppendingFormat:@"\t%@ : %@\n", key, [self.blocks objectForKey:key]]; 239 | } 240 | return [NSString stringWithFormat:@"Swizzle on %@::%@ [\n%@]", NSStringFromClass(self.class), NSStringFromSelector(self.selector), descriptors]; 241 | } 242 | 243 | @end 244 | -------------------------------------------------------------------------------- /KillBug/Classes/Core/KBTrackConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // KBTrackConfig.h 3 | // KillBug 4 | // 5 | // Created by 2020 on 2021/3/29. 6 | // 7 | 8 | #pragma mark - Track 配置 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface KBTrackConfig : NSObject 15 | /** 16 | 自动采集默认需要过滤的控制器列表 17 | */ 18 | @property(copy,nonatomic) NSArray* controllers; 19 | 20 | + (NSArray*)controllers; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /KillBug/Classes/Core/KBTrackConfig.m: -------------------------------------------------------------------------------- 1 | // 2 | // KBTrackConfig.m 3 | // KillBug 4 | // 5 | // Created by 2020 on 2021/3/29. 6 | // 7 | 8 | #import "KBTrackConfig.h" 9 | 10 | static KBTrackConfig* config; 11 | 12 | @implementation KBTrackConfig 13 | + (void)load 14 | { 15 | static dispatch_once_t onceToken; 16 | dispatch_once(&onceToken, ^{ 17 | config = [KBTrackConfig new]; 18 | }); 19 | } 20 | - (instancetype)init 21 | { 22 | self = [super init]; 23 | if(self) 24 | { 25 | self.controllers = @[ 26 | @"UICompatibilityInputViewController", 27 | @"UIKeyboardCandidateGridCollectionViewController", 28 | @"UIInputWindowController", 29 | @"UIApplicationRotationFollowingController", 30 | @"UIApplicationRotationFollowingControllerNoTouches", 31 | @"UISystemKeyboardDockController", 32 | @"UINavigationController", 33 | @"SFBrowserRemoteViewController", 34 | @"SFSafariViewController", 35 | @"UIAlertController", 36 | @"UIImagePickerController", 37 | @"PUPhotoPickerHostViewController", 38 | @"UIViewController", 39 | @"UITableViewController", 40 | @"UITabBarController", 41 | @"_UIRemoteInputViewController", 42 | @"UIEditingOverlayViewController", 43 | @"_UIAlertControllerTextFieldViewController", 44 | @"UIActivityGroupViewController", 45 | @"_UISFAirDropInstructionsViewController", 46 | @"_UIActivityGroupListViewController", 47 | @"_UIShareExtensionRemoteViewController", 48 | @"SLRemoteComposeViewController", 49 | @"SLComposeViewController", 50 | ]; 51 | } 52 | return self; 53 | } 54 | + (NSArray*)controllers 55 | { 56 | return config.controllers; 57 | } 58 | @end 59 | -------------------------------------------------------------------------------- /KillBug/Classes/Core/KBUIApplicationEvents.h: -------------------------------------------------------------------------------- 1 | // 2 | // KBUIApplicationEvents.h 3 | // KillBug 4 | // 5 | // Created by 2020 on 2021/3/29. 6 | // 7 | 8 | #pragma mark - app 生命周期 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface KBUIApplicationEvents : NSObject 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /KillBug/Classes/Core/KBUIApplicationEvents.m: -------------------------------------------------------------------------------- 1 | // 2 | // KBUIApplicationEvents.m 3 | // KillBug 4 | // 5 | // Created by 2020 on 2021/3/29. 6 | // 7 | 8 | #import "KBUIApplicationEvents.h" 9 | #import "KBAutoTrackManager.h" 10 | 11 | static NSUncaughtExceptionHandler *preUncaughtExceptionHandler; 12 | 13 | @implementation KBUIApplicationEvents 14 | - (instancetype)init 15 | { 16 | self = [super init]; 17 | if (self) { 18 | [self setApplicationListeners]; 19 | /// 注册 20 | preUncaughtExceptionHandler = NSGetUncaughtExceptionHandler(); 21 | NSSetUncaughtExceptionHandler(&UncaughtExceptionHandler); 22 | } 23 | return self; 24 | } 25 | /// 抓崩溃 26 | void UncaughtExceptionHandler(NSException *exception){ 27 | if (exception ==nil)return; 28 | NSString *reason = [exception reason]; 29 | NSString *name = [exception name]; 30 | /// 这里就只采集描述吧,具体的堆栈信息,去bug收集平台查看 31 | NSDictionary *dict = @{@"appException":@{@"exceptionreason":reason,@"exceptionname":name}}; 32 | // 把异常抛出去给其他SDK处理,避免其他SDK解析出现问题 33 | if (preUncaughtExceptionHandler){ 34 | preUncaughtExceptionHandler(exception); 35 | } 36 | NSString *info = [KBUIApplicationEvents dictionaryToJson:dict]; 37 | [[KBAutoTrackManager shared] trackApplicationDeadReason:info]; 38 | } 39 | + (NSString*)dictionaryToJson:(NSDictionary *)dic 40 | { 41 | NSError *parseError = nil; 42 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&parseError]; 43 | 44 | return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; 45 | } 46 | - (void)setApplicationListeners { 47 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 48 | 49 | [notificationCenter addObserver:self 50 | selector:@selector(applicationWillEnterForeground:) 51 | name:UIApplicationWillEnterForegroundNotification 52 | object:nil]; 53 | 54 | [notificationCenter addObserver:self 55 | selector:@selector(applicationDidBecomeActive:) 56 | name:UIApplicationDidBecomeActiveNotification 57 | object:nil]; 58 | 59 | [notificationCenter addObserver:self 60 | selector:@selector(applicationWillResignActive:) 61 | name:UIApplicationWillResignActiveNotification 62 | object:nil]; 63 | 64 | [notificationCenter addObserver:self 65 | selector:@selector(applicationDidEnterBackground:) 66 | name:UIApplicationDidEnterBackgroundNotification 67 | object:nil]; 68 | 69 | [notificationCenter addObserver:self 70 | selector:@selector(applicationWillTerminate:) 71 | name:UIApplicationWillTerminateNotification 72 | object:nil]; 73 | } 74 | 75 | - (void)applicationWillEnterForeground:(NSNotification *)notification { 76 | [[KBAutoTrackManager shared] trackApplication:@"将进入前台"]; 77 | } 78 | 79 | - (void)applicationDidEnterBackground:(NSNotification *)notification { 80 | [[KBAutoTrackManager shared] trackApplication:@"已进入后台"]; 81 | } 82 | 83 | - (void)applicationWillResignActive:(NSNotification *)notification { 84 | [[KBAutoTrackManager shared] trackApplication:@"将非活跃"]; 85 | } 86 | 87 | - (void)applicationDidBecomeActive:(NSNotification *)notification { 88 | [[KBAutoTrackManager shared] trackApplication:@"已经活跃"]; 89 | } 90 | /// 只能检测到前台被杀死, 91 | /// 后台杀死检测不到(Terminated due to signal 9) 92 | /// 崩溃也检测不到 93 | - (void)applicationWillTerminate:(NSNotification *)notification { 94 | [[KBAutoTrackManager shared] trackApplication:@"前台被用户将被杀死"]; 95 | } 96 | @end 97 | -------------------------------------------------------------------------------- /KillBug/Classes/Core/NSObject+KBSwizzle.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+KBSwizzle.h 3 | // KillBug 4 | // 5 | // Created by 2020 on 2021/3/29. 6 | // 7 | #pragma mark - NSObject 类的方法交换 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface NSObject (KBSwizzle) 14 | + (BOOL)kb_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError **)error_; 15 | + (BOOL)kb_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError **)error_; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /KillBug/Classes/Core/NSObject+KBSwizzle.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+KBSwizzle.m 3 | // KillBug 4 | // 5 | // Created by 2020 on 2021/3/29. 6 | // 7 | 8 | #import "NSObject+KBSwizzle.h" 9 | #if TARGET_OS_IPHONE 10 | #import 11 | #import 12 | #else 13 | #import 14 | #endif 15 | 16 | #define SetNSErrorFor(FUNC, ERROR_VAR, FORMAT,...) \ 17 | if (ERROR_VAR) { \ 18 | NSString *errStr = [NSString stringWithFormat:@"%s: " FORMAT,FUNC,##__VA_ARGS__]; \ 19 | *ERROR_VAR = [NSError errorWithDomain:@"NSCocoaErrorDomain" \ 20 | code:-1 \ 21 | userInfo:[NSDictionary dictionaryWithObject:errStr forKey:NSLocalizedDescriptionKey]]; \ 22 | } 23 | #define SetNSError(ERROR_VAR, FORMAT,...) SetNSErrorFor(__func__, ERROR_VAR, FORMAT, ##__VA_ARGS__) 24 | 25 | @implementation NSObject (KBSwizzle) 26 | + (BOOL)kb_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError **)error_ { 27 | Method origMethod = class_getInstanceMethod(self, origSel_); 28 | if (!origMethod) { 29 | SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self class]); 30 | return NO; 31 | } 32 | 33 | Method altMethod = class_getInstanceMethod(self, altSel_); 34 | if (!altMethod) { 35 | SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self class]); 36 | return NO; 37 | } 38 | 39 | class_addMethod(self, 40 | origSel_, 41 | class_getMethodImplementation(self, origSel_), 42 | method_getTypeEncoding(origMethod)); 43 | class_addMethod(self, 44 | altSel_, 45 | class_getMethodImplementation(self, altSel_), 46 | method_getTypeEncoding(altMethod)); 47 | 48 | method_exchangeImplementations(class_getInstanceMethod(self, origSel_), class_getInstanceMethod(self, altSel_)); 49 | return YES; 50 | } 51 | 52 | + (BOOL)kb_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError **)error_ { 53 | return [object_getClass((id)self) kb_swizzleMethod:origSel_ withMethod:altSel_ error:error_]; 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /KillBug/Classes/Manager/KBAutoTrackManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // KBAutoTrackManager.h 3 | // KillBug 4 | // 5 | // Created by 2020 on 2021/3/29. 6 | // 7 | 8 | #pragma mark - 自动跟踪管理 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | typedef void (^DebugInfoHandler)(NSString *info); 15 | 16 | @interface KBAutoTrackManager : NSObject 17 | 18 | @property(nonatomic,strong)DebugInfoHandler infoHandler; 19 | 20 | ///单例 21 | + (instancetype)shared; 22 | 23 | /// 普通 UIControl 24 | - (void)trackEventView:(UIView *)view; 25 | 26 | /// tableview&collectionview 27 | - (void)trackEventView:(UIView *)view withIndexPath:(nullable NSIndexPath *)indexPath; 28 | 29 | /// viewWillAppear 30 | - (void)trackViewWillAppear:(UIViewController *)controller; 31 | 32 | /// uiapplication 活跃状态 33 | - (void)trackApplication:(NSString *)state; 34 | 35 | /// uiapplication 死亡信息 36 | - (void)trackApplicationDeadReason:(NSString *)reason; 37 | 38 | /// 用户的touch事件 39 | - (void)trackTouch:(NSString *)info; 40 | 41 | /// 日志回调 42 | - (void)debugInfoHandler:(DebugInfoHandler)handler; 43 | 44 | @end 45 | 46 | NS_ASSUME_NONNULL_END 47 | -------------------------------------------------------------------------------- /KillBug/Classes/Manager/KBAutoTrackManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // KBAutoTrackManager.m 3 | // KillBug 4 | // 5 | // Created by 2020 on 2021/3/29. 6 | // 7 | 8 | #import "KBAutoTrackManager.h" 9 | #import "KBSwizzler.h" 10 | #import "UIApplication+KBAutoTrack.h" 11 | #import "UIViewController+KBAutoTrack.h" 12 | #import "NSObject+KBSwizzle.h" 13 | #import "KBTrackConfig.h" 14 | #import "KBUIApplicationEvents.h" 15 | #import "UIView+KBAutoTrack.h" 16 | @interface KBAutoTrackManager() 17 | @property(nonatomic,strong)KBUIApplicationEvents *lister; 18 | @end 19 | 20 | @implementation KBAutoTrackManager 21 | 22 | #pragma mark - Public 23 | 24 | + (instancetype)shared { 25 | static dispatch_once_t once; 26 | static KBAutoTrackManager *instance = nil; 27 | dispatch_once(&once, ^{ 28 | instance = [[[KBAutoTrackManager class] alloc] init]; 29 | [instance autoSwizzle]; 30 | instance.lister = [[KBUIApplicationEvents alloc] init]; 31 | }); 32 | return instance; 33 | } 34 | /// 普通 UIControl 支持xib拖出来的 35 | - (void)trackEventView:(UIView *)view { 36 | NSString *str = [[NSString alloc] initWithFormat:@"click: %@ txt:%@",view.class,[KBAutoTrackManager getText:view]]; 37 | self.infoHandler(str); 38 | } 39 | /// tableview&collectionview 40 | - (void)trackEventView:(UIView *)view withIndexPath:(nullable NSIndexPath *)indexPath { 41 | NSString *str = [[NSString alloc] initWithFormat:@"click: %@ row: %ld section: %ld",view.class,(long)indexPath.row,(long)indexPath.section]; 42 | self.infoHandler(str); 43 | } 44 | /// viewcontroller 45 | - (void)trackViewWillAppear:(UIViewController *)controller { 46 | if ([self shouldTrackViewContrller:[controller class]]){ 47 | NSString *str = [[NSString alloc] initWithFormat:@"will appear: %@",[self titleFromViewController:controller]]; 48 | self.infoHandler(str); 49 | } 50 | } 51 | /// application 活跃状态 52 | - (void)trackApplication:(NSString *)state;{ 53 | NSString *str = [[NSString alloc] initWithFormat:@"app state: %@",state]; 54 | self.infoHandler(str); 55 | } 56 | /// app 死亡信息 57 | - (void)trackApplicationDeadReason:(NSString *)reason;{ 58 | NSString *str = [[NSString alloc] initWithFormat:@"app crash: %@",reason]; 59 | self.infoHandler(str); 60 | } 61 | - (void)trackTouch:(NSString *)info;{ 62 | NSString *str = [[NSString alloc] initWithFormat:@"touch: %@",info]; 63 | self.infoHandler(str); 64 | } 65 | - (BOOL)shouldTrackViewContrller:(Class)aClass { 66 | return ![KBTrackConfig.controllers containsObject:NSStringFromClass(aClass)]; 67 | } 68 | 69 | - (void)debugInfoHandler:(DebugInfoHandler)handler;{ 70 | self.infoHandler = handler; 71 | } 72 | 73 | 74 | // tableview collectionview 75 | - (void)swizzleSelected:(UIView *)view delegate:(id)delegate { 76 | if ([view isKindOfClass:[UITableView class]] 77 | && [delegate conformsToProtocol:@protocol(UITableViewDelegate)]) { 78 | void (^block)(id, SEL, id, id) = ^(id target, SEL command, UITableView *tableView, NSIndexPath *indexPath) { 79 | [self trackEventView:tableView withIndexPath:indexPath]; 80 | }; 81 | 82 | [KBSwizzler swizzleSelector:@selector(tableView:didSelectRowAtIndexPath:) 83 | onClass:[delegate class] 84 | withBlock:block 85 | named:@"kb_table_select"]; 86 | } 87 | 88 | if ([view isKindOfClass:[UICollectionView class]] 89 | && [delegate conformsToProtocol:@protocol(UICollectionViewDelegate)]) { 90 | 91 | void (^block)(id, SEL, id, id) = ^(id target, SEL command, UICollectionView *collectionView, NSIndexPath *indexPath) { 92 | [self trackEventView:collectionView withIndexPath:indexPath]; 93 | }; 94 | [KBSwizzler swizzleSelector:@selector(collectionView:didSelectItemAtIndexPath:) 95 | onClass:[delegate class] 96 | withBlock:block 97 | named:@"kb_collection_select"]; 98 | } 99 | } 100 | 101 | - (void)autoSwizzle { 102 | static dispatch_once_t onceToken; 103 | dispatch_once(&onceToken, ^{ 104 | void (^tableViewBlock)(UITableView *tableView, 105 | SEL cmd, 106 | id delegate) = 107 | ^(UITableView *tableView, SEL cmd, id delegate) { 108 | if (!delegate) { 109 | return; 110 | } 111 | 112 | [self swizzleSelected:tableView delegate:delegate]; 113 | }; 114 | 115 | [KBSwizzler swizzleSelector:@selector(setDelegate:) 116 | onClass:[UITableView class] 117 | withBlock:tableViewBlock 118 | named:@"kb_table_delegate"]; 119 | 120 | void (^collectionViewBlock)(UICollectionView *, SEL, id) = ^(UICollectionView *collectionView, SEL cmd, id delegate) { 121 | if (nil == delegate) { 122 | return; 123 | } 124 | 125 | [self swizzleSelected:collectionView delegate:delegate]; 126 | }; 127 | [KBSwizzler swizzleSelector:@selector(setDelegate:) 128 | onClass:[UICollectionView class] 129 | withBlock:collectionViewBlock 130 | named:@"kb_collection_delegate"]; 131 | 132 | [UIViewController kb_swizzleMethod:@selector(viewWillAppear:) 133 | withMethod:@selector(kb_autotrack_viewWillAppear:) 134 | error:NULL]; 135 | 136 | [UIApplication kb_swizzleMethod:@selector(sendAction:to:from:forEvent:) 137 | withMethod:@selector(kb_sendAction:to:from:forEvent:) 138 | error:NULL]; 139 | 140 | [UIView kb_autoTrack]; 141 | }); 142 | } 143 | 144 | + (NSString *)getText:(NSObject *)obj { 145 | NSString *text = nil; 146 | if ([obj isKindOfClass:[UIButton class]]) { 147 | text = ((UIButton *)obj).currentTitle; 148 | } else if ([obj isKindOfClass:[UITextView class]] || 149 | [obj isKindOfClass:[UITextField class]]) { 150 | //ignore 151 | } else if ([obj isKindOfClass:[UILabel class]]) { 152 | text = ((UILabel *)obj).text; 153 | } else if ([obj isKindOfClass:[UIPickerView class]]) { 154 | UIPickerView *picker = (UIPickerView *)obj; 155 | NSInteger sections = picker.numberOfComponents; 156 | NSMutableArray *titles = [NSMutableArray array]; 157 | 158 | for(NSInteger i = 0; i < sections; i++) { 159 | NSInteger row = [picker selectedRowInComponent:i]; 160 | NSString *title; 161 | if ([picker.delegate 162 | respondsToSelector:@selector(pickerView:titleForRow:forComponent:)]) { 163 | title = [picker.delegate pickerView:picker titleForRow:row forComponent:i]; 164 | } else if ([picker.delegate 165 | respondsToSelector:@selector(pickerView:attributedTitleForRow:forComponent:)]) { 166 | title = [picker.delegate 167 | pickerView:picker 168 | attributedTitleForRow:row forComponent:i].string; 169 | } 170 | [titles addObject:title ?: @""]; 171 | } 172 | if (titles.count > 0) { 173 | text = [titles componentsJoinedByString:@","]; 174 | } 175 | } else if ([obj isKindOfClass:[UIDatePicker class]]) { 176 | UIDatePicker *picker = (UIDatePicker *)obj; 177 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 178 | formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss.SSS"; 179 | text = [formatter stringFromDate:picker.date]; 180 | } else if ([obj isKindOfClass:[UISegmentedControl class]]) { 181 | UISegmentedControl *segment = (UISegmentedControl *)obj; 182 | text = [NSString stringWithFormat:@"%@", [segment titleForSegmentAtIndex:segment.selectedSegmentIndex]]; 183 | } else if ([obj isKindOfClass:[UISwitch class]]) { 184 | UISwitch *switchItem = (UISwitch *)obj; 185 | text = switchItem.on ? @"on" : @"off"; 186 | } else if ([obj isKindOfClass:[UISlider class]]) { 187 | UISlider *slider = (UISlider *)obj; 188 | text = [NSString stringWithFormat:@"%f", [slider value]]; 189 | } else if ([obj isKindOfClass:[UIStepper class]]) { 190 | UIStepper *step = (UIStepper *)obj; 191 | text = [NSString stringWithFormat:@"%f", [step value]]; 192 | } else { 193 | if ([obj isKindOfClass:[UIView class]]) { 194 | for(UIView *subView in [(UIView *)obj subviews]) { 195 | text = [KBAutoTrackManager getText:subView]; 196 | if ([text isKindOfClass:[NSString class]] && text.length > 0) { 197 | break; 198 | } 199 | } 200 | } 201 | } 202 | return text; 203 | } 204 | 205 | - (NSString *)titleFromViewController:(UIViewController *)viewController { 206 | NSString *title = viewController.navigationItem.title; 207 | NSString *className = NSStringFromClass(viewController.class); 208 | if (title){ 209 | return [title stringByAppendingString:className]; 210 | }else{ 211 | return className; 212 | } 213 | } 214 | 215 | @end 216 | -------------------------------------------------------------------------------- /KillBug/Classes/UI/UIApplication+KBAutoTrack.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIApplication+KBAutoTrack.h 3 | // KillBug 4 | // 5 | // Created by 2020 on 2021/3/29. 6 | // 7 | 8 | #pragma mark - action 交换 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface UIApplication (KBAutoTrack) 15 | - (BOOL)kb_sendAction:(SEL)action 16 | to:(nullable id)to 17 | from:(nullable id)from 18 | forEvent:(nullable UIEvent *)event; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /KillBug/Classes/UI/UIApplication+KBAutoTrack.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIApplication+KBAutoTrack.m 3 | // KillBug 4 | // 5 | // Created by 2020 on 2021/3/29. 6 | // 7 | 8 | #import "UIApplication+KBAutoTrack.h" 9 | #import "KBAutoTrackManager.h" 10 | 11 | @implementation UIApplication (KBAutoTrack) 12 | - (BOOL)kb_sendAction:(SEL)action to:(id)to from:(id)from forEvent:(UIEvent *)event; { 13 | if ([from isKindOfClass:[UIControl class]]) { 14 | //UISegmentedControl UISwitch UIStepper UISlider 15 | if (([from isKindOfClass:[UISwitch class]] || 16 | [from isKindOfClass:[UISegmentedControl class]] || 17 | [from isKindOfClass:[UIStepper class]])) { 18 | [[KBAutoTrackManager shared] trackEventView:from]; 19 | } 20 | 21 | //UIButton UIPageControl UITabBarButton _UIButtonBarButton 22 | else if ([event isKindOfClass:[UIEvent class]] && event.type == UIEventTypeTouches && [[[event allTouches] anyObject] phase] == UITouchPhaseEnded) { 23 | [[KBAutoTrackManager shared] trackEventView:from]; 24 | } 25 | } 26 | 27 | return [self kb_sendAction:action to:to from:from forEvent:event]; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /KillBug/Classes/UI/UIView+KBAutoTrack.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+KBAutoTrack.h 3 | // KillBug 4 | // 5 | // Created by 2020 on 2021/3/30. 6 | // 7 | 8 | #pragma mark - touch方法 交换 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface UIView (KBAutoTrack) 15 | + (void)kb_autoTrack; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /KillBug/Classes/UI/UIView+KBAutoTrack.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+KBAutoTrack.m 3 | // KillBug 4 | // 5 | // Created by 2020 on 2021/3/30. 6 | // 7 | 8 | #import "UIView+KBAutoTrack.h" 9 | #import 10 | #import "KBAutoTrackManager.h" 11 | /// https://shixiong.name/2019/03/01/the-right-way-to-swizzling/index.html 12 | static IMP __original_TouchesBegan_Method_Imp; 13 | 14 | @implementation UIView (KBAutoTrack) 15 | 16 | + (void)kb_autoTrack { 17 | 18 | Class class = [self class]; 19 | 20 | SEL originalSelector = @selector(touchesBegan:withEvent:); 21 | SEL swizzledSelector = @selector(kb_touchesBegan:withEvent:); 22 | 23 | Method originalMethod = class_getInstanceMethod(class, originalSelector); 24 | Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector); 25 | 26 | __original_TouchesBegan_Method_Imp = method_getImplementation(originalMethod); 27 | 28 | BOOL didAddMethod = 29 | class_addMethod(class, 30 | originalSelector, 31 | method_getImplementation(swizzledMethod), 32 | method_getTypeEncoding(swizzledMethod)); 33 | 34 | if (didAddMethod) { 35 | class_replaceMethod(class, 36 | swizzledSelector, 37 | method_getImplementation(originalMethod), 38 | method_getTypeEncoding(originalMethod)); 39 | } else { 40 | method_exchangeImplementations(originalMethod, swizzledMethod); 41 | } 42 | } 43 | 44 | - (void)kb_touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 45 | 46 | //获取触摸对象 47 | UITouch * touch = touches.anyObject; 48 | CGPoint p = [touch locationInView:touch.view]; 49 | NSString *content = @""; 50 | if ([touch.view isKindOfClass:[UILabel class]]){ 51 | content = ((UILabel*)touch.view).text; 52 | } 53 | if (touch.tapCount == 1){ 54 | NSString *info = [[NSString alloc] initWithFormat:@"单击 位置 x:%f y:%f",p.x,p.y]; 55 | [[KBAutoTrackManager shared] trackTouch:info]; 56 | 57 | }else if (touch.tapCount == 2){ 58 | NSString *info = [[NSString alloc] initWithFormat:@"双击 位置 x:%f y:%f",p.x,p.y]; 59 | [[KBAutoTrackManager shared] trackTouch:info]; 60 | }else{ 61 | NSString *info = [[NSString alloc] initWithFormat:@"%ld次 位置 x:%f y:%f",touch.tapCount,p.x,p.y]; 62 | [[KBAutoTrackManager shared] trackTouch:info]; 63 | } 64 | 65 | 66 | void (*functionPointer)(id, SEL, NSSet *, UIEvent *) = (void(*)(id, SEL, NSSet *, UIEvent*))__original_TouchesBegan_Method_Imp; 67 | functionPointer(self, _cmd, touches, event); 68 | } 69 | @end 70 | -------------------------------------------------------------------------------- /KillBug/Classes/UI/UIViewController+KBAutoTrack.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+KBAutoTrack.h 3 | // KillBug 4 | // 5 | // Created by 2020 on 2021/3/29. 6 | // 7 | 8 | #pragma mark - viewWillAppear 交换 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface UIViewController (KBAutoTrack) 15 | - (void)kb_autotrack_viewWillAppear:(BOOL)animated; 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /KillBug/Classes/UI/UIViewController+KBAutoTrack.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+KBAutoTrack.m 3 | // KillBug 4 | // 5 | // Created by 2020 on 2021/3/29. 6 | // 7 | 8 | #import "UIViewController+KBAutoTrack.h" 9 | #import "KBAutoTrackManager.h" 10 | 11 | @implementation UIViewController (KBAutoTrack) 12 | 13 | - (void)kb_autotrack_viewWillAppear:(BOOL)animated; { 14 | [[KBAutoTrackManager shared] trackViewWillAppear:self]; 15 | [self kb_autotrack_viewWillAppear:animated]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KillBug 2 | 3 | [![CI Status](https://img.shields.io/travis/tliens/KillBug.svg?style=flat)](https://travis-ci.org/tliens/KillBug) 4 | [![Version](https://img.shields.io/cocoapods/v/KillBug.svg?style=flat)](https://cocoapods.org/pods/KillBug) 5 | [![License](https://img.shields.io/cocoapods/l/KillBug.svg?style=flat)](https://cocoapods.org/pods/KillBug) 6 | [![Platform](https://img.shields.io/cocoapods/p/KillBug.svg?style=flat)](https://cocoapods.org/pods/KillBug) 7 | 8 | ![img](https://github.com/Tliens/KillBug/blob/main/logo.png) 9 | 10 | ## 揪心的bug 11 | 12 | 我们通过第三方工具分析捕获 mach信号或unix信号获取崩溃信息,但有时明明查到了具体的崩溃地点,确觉得这行代码似乎找不出问题。 13 | 14 | 崩溃无法复现,这个问题可能就不了了之了,崩溃率也就居高不下。 15 | 16 | 那有没有一个办法可以记录下来用户的操作步骤用于复现呢?可不可以记录现场? 17 | 18 | 于是我花了一天的时间写了这款工具:*KillBug* 19 | 20 | > bugtags 中也有KillBug的功能。我们之前使用过,并成功的把崩溃率降低到了十万分之一。用户交互日志功不可没。 21 | 22 | 23 | 此工具用来收集用户操作步骤: 24 | - 1、可用于bug复现,问题排查 25 | - 2、分析用户操作日志 26 | 27 | 采用 runtime method swizzle 实现,为了不影响app的启动速度,method swizzle 需要手动开启。 28 | 29 | 支持Swift、OC以及混编项目。 30 | 31 | 目前支持采集如下内容: 32 | 33 | ``` 34 | ///单例 35 | + (instancetype)shared; 36 | 37 | /// 普通 UIControl 38 | - (void)trackEventView:(UIView *)view; 39 | 40 | /// tableview&collectionview 41 | - (void)trackEventView:(UIView *)view withIndexPath:(nullable NSIndexPath *)indexPath; 42 | 43 | /// viewWillAppear 44 | - (void)trackViewWillAppear:(UIViewController *)controller; 45 | 46 | /// uiapplication 活跃状态 47 | - (void)trackApplication:(NSString *)state; 48 | 49 | /// uiapplication 死亡信息 50 | - (void)trackApplicationDeadReason:(NSString *)reason; 51 | 52 | /// 用户的touch事件 53 | - (void)trackTouch:(NSString *)info; 54 | 55 | /// 日志回调 56 | - (void)debugInfoHandler:(DebugInfoHandler)handler; 57 | 58 | ``` 59 | ## 使用 60 | ``` 61 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 62 | { 63 | // Override point for customization after application launch. 64 | KBAutoTrackManager *manager = [KBAutoTrackManager shared]; 65 | [manager debugInfoHandler:^(NSString * _Nonnull info) { 66 | NSLog(@"%@", info); 67 | /// Custom 68 | }]; 69 | return YES; 70 | } 71 | 72 | ``` 73 | 74 | ## 采集日志 75 | ``` 76 | 2021-03-30 11:20:53.215736+0800 KillBug_Example[962:142129] will appear: KBViewController 77 | 2021-03-30 11:20:53.265620+0800 KillBug_Example[962:142129] app state: 已经活跃 78 | 2021-03-30 11:20:54.720428+0800 KillBug_Example[962:142129] touch: 单击 位置 x:245.333328 y:629.333328 79 | 2021-03-30 11:20:54.761609+0800 KillBug_Example[962:142129] will appear: KBViewControllerA 80 | 2021-03-30 11:20:59.767387+0800 KillBug_Example[962:142129] touch: 单击 位置 x:138.333328 y:35.333328 81 | 2021-03-30 11:20:59.767880+0800 KillBug_Example[962:142129] touch: 单击 位置 x:138.333328 y:35.333328 82 | 2021-03-30 11:20:59.776511+0800 KillBug_Example[962:142129] click: UITableView row: 4 section: 0 83 | 2021-03-30 11:21:06.493889+0800 KillBug_Example[962:142129] touch: 单击 位置 x:261.000000 y:645.333328 84 | 2021-03-30 11:21:09.982150+0800 KillBug_Example[962:142129] click: UIButton txt:ButtonA 85 | 2021-03-30 11:21:14.463084+0800 KillBug_Example[962:142129] click: UIButton txt:小明 86 | 2021-03-30 11:21:17.768582+0800 KillBug_Example[962:142129] app state: 将非活跃 87 | 2021-03-30 11:21:18.677035+0800 KillBug_Example[962:142129] app state: 已进入后台 88 | 2021-03-30 11:21:23.629401+0800 KillBug_Example[962:142129] app state: 将进入前台 89 | 2021-03-30 11:21:23.954509+0800 KillBug_Example[962:142129] app state: 已经活跃 90 | 2021-03-30 11:21:25.641821+0800 KillBug_Example[962:142129] click: UIButton txt:崩溃测试 91 | 2021-03-30 11:21:25.643086+0800 KillBug_Example[962:142129] app crash: { 92 | "appException" : { 93 | "exceptionreason" : "*** -[__NSSingleObjectArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]", 94 | "exceptionname" : "NSRangeException" 95 | } 96 | } 97 | ``` 98 | ## Example 99 | 100 | To run the example project, clone the repo, and run `pod install` from the Example directory first. 101 | 102 | ## Requirements 103 | 104 | ## Installation 105 | 106 | KillBug is available through [CocoaPods](https://cocoapods.org). To install 107 | it, simply add the following line to your Podfile: 108 | 109 | ```ruby 110 | pod 'KillBug' 111 | ``` 112 | ## 我的其他开源框架 113 | 114 | - [SpeedySwift 独立开发者必备](https://github.com/Tliens/SpeedySwift) 115 | 116 | - [CTNet 这是一个可以指定缓存、重试、优先级的轻量级网络库](https://github.com/ours-curiosity/CTNet) 117 | 118 | - [Localizable 国际化方案](https://github.com/Tliens/Localizable) 119 | 120 | - [SpeedyMetal Metal 加速框架,GPUImage3的尝试演化](https://github.com/Tliens/SpeedyMetal) 121 | 122 | - [GPUImageByMetal GPUImage 3 中文注释版](https://github.com/Tliens/GPUImageByMetal) 123 | 124 | ## Author 125 | 126 | tliens, maninios@163.com 127 | 128 | ## License 129 | 130 | KillBug is available under the MIT license. See the LICENSE file for more info. 131 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tliens/KillBug/683da9e700652453d01838304d87106c92ad58bc/logo.png -------------------------------------------------------------------------------- /publish.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | def push(): 4 | 5 | checkCommand = "pod spec lint KillBug.podspec --allow-warnings" 6 | pushCommand = "pod trunk push KillBug.podspec --allow-warnings --allow-warnings" 7 | checkRet = os.system(checkCommand) 8 | if checkRet != 0: 9 | print("校验出错,请检查spec文件是否配置正确") 10 | exit - 1 11 | else: 12 | pushRet = os.system(pushCommand) 13 | if pushRet != 0: 14 | print("上传失败!") 15 | exit - 1 16 | else: 17 | print("上传完成!!") 18 | return 19 | 20 | 21 | if __name__ == "__main__": 22 | push() 23 | --------------------------------------------------------------------------------