├── .gitignore ├── LICENSE ├── NetworkEye.podspec ├── NetworkEye.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── NetworkEye.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── NetworkEye ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── DemoViewController.h ├── DemoViewController.m ├── Info.plist ├── NetworkEye │ ├── NEHTTPEye.h │ ├── NEHTTPEye.m │ ├── NEHTTPEyeDetailViewController.h │ ├── NEHTTPEyeDetailViewController.m │ ├── NEHTTPEyeSettingsViewController.h │ ├── NEHTTPEyeSettingsViewController.m │ ├── NEHTTPEyeViewController.h │ ├── NEHTTPEyeViewController.m │ ├── NEHTTPModel.h │ ├── NEHTTPModel.m │ ├── NEHTTPModelManager.h │ ├── NEHTTPModelManager.m │ ├── NEKeyboardShortcutManager.h │ ├── NEKeyboardShortcutManager.m │ ├── NEMapViewController.h │ ├── NEMapViewController.m │ ├── NEShakeGestureManager.h │ ├── NEShakeGestureManager.m │ ├── NEURLSessionConfiguration.h │ ├── NEURLSessionConfiguration.m │ ├── UIWindow+NEExtension.h │ └── UIWindow+NEExtension.m ├── Resources │ ├── networkeye1.png │ ├── networkeye1_1.png │ ├── networkeye1_2.png │ ├── networkeye1_3.png │ ├── networkeye2.png │ ├── networkeye3.png │ ├── networkeye4.png │ ├── networkeye5.png │ ├── networkeye_logo.png │ ├── networkeye_logo.sketch │ ├── networkeye_logo_detail.png │ ├── networkeye_logo_detail.sketch │ └── networkeye_logo_detail@1x.png └── main.m ├── NetworkEyeTests ├── Info.plist └── NetworkEyeTests.m ├── NetworkEyeUITests ├── Info.plist └── NetworkEyeUITests.m ├── Podfile ├── Podfile.lock ├── README.md └── README_Chinese.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 coderyi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /NetworkEye.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "NetworkEye" 3 | s.version = "1.1.2" 4 | s.summary = "NetworkEye - a iOS network debug library ,It can monitor HTTP requests within the App and displays information related to the request." 5 | s.homepage = "https://github.com/coderyi/NetworkEye" 6 | s.license = "MIT" 7 | s.authors = { "coderyi" => "coderyi@163.com" } 8 | s.source = { :git => "https://github.com/coderyi/NetworkEye.git", :tag => "1.1.2" } 9 | s.frameworks = 'Foundation', 'CoreGraphics', 'UIKit' 10 | s.platform = :ios, '8.0' 11 | s.requires_arc = true 12 | s.default_subspec = 'standard' 13 | 14 | s.subspec 'standard' do |ss| 15 | ss.source_files = 'NetworkEye/NetworkEye/**/*.{h,m,png}' 16 | end 17 | 18 | s.subspec 'FMDB' do |ss| 19 | ss.library = "sqlite3" 20 | ss.xcconfig = { 'OTHER_CFLAGS' => '$(inherited) -DFMDB_SQLCipher' } 21 | ss.dependency "FMDB/SQLCipher", "~> 2.5" 22 | ss.source_files = 'NetworkEye/NetworkEye/**/*.{h,m,png}' 23 | end 24 | 25 | 26 | 27 | 28 | end -------------------------------------------------------------------------------- /NetworkEye.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0A09FAC01BF6FC3F0009EC53 /* UIWindow+NEExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A09FABF1BF6FC3F0009EC53 /* UIWindow+NEExtension.m */; }; 11 | 0A1202E31BF097BC00B710A9 /* NEURLSessionConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A1202E21BF097BC00B710A9 /* NEURLSessionConfiguration.m */; }; 12 | 0A4EF8451BEB66FF000D2D7E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A4EF8441BEB66FF000D2D7E /* main.m */; }; 13 | 0A4EF8481BEB66FF000D2D7E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A4EF8471BEB66FF000D2D7E /* AppDelegate.m */; }; 14 | 0A4EF84E1BEB66FF000D2D7E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0A4EF84C1BEB66FF000D2D7E /* Main.storyboard */; }; 15 | 0A4EF8501BEB66FF000D2D7E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0A4EF84F1BEB66FF000D2D7E /* Assets.xcassets */; }; 16 | 0A4EF8531BEB66FF000D2D7E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0A4EF8511BEB66FF000D2D7E /* LaunchScreen.storyboard */; }; 17 | 0A4EF85E1BEB66FF000D2D7E /* NetworkEyeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A4EF85D1BEB66FF000D2D7E /* NetworkEyeTests.m */; }; 18 | 0A4EF8691BEB66FF000D2D7E /* NetworkEyeUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A4EF8681BEB66FF000D2D7E /* NetworkEyeUITests.m */; }; 19 | 0A4EF8951BEB6735000D2D7E /* NEHTTPEye.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A4EF8801BEB6735000D2D7E /* NEHTTPEye.m */; }; 20 | 0A4EF8961BEB6735000D2D7E /* NEHTTPEyeDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A4EF8821BEB6735000D2D7E /* NEHTTPEyeDetailViewController.m */; }; 21 | 0A4EF8971BEB6735000D2D7E /* NEHTTPEyeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A4EF8841BEB6735000D2D7E /* NEHTTPEyeViewController.m */; }; 22 | 0A4EF8981BEB6735000D2D7E /* NEHTTPModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A4EF8861BEB6735000D2D7E /* NEHTTPModel.m */; }; 23 | 0A4EF8991BEB6735000D2D7E /* NEHTTPModelManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A4EF8881BEB6735000D2D7E /* NEHTTPModelManager.m */; }; 24 | 0A4EF89A1BEB6735000D2D7E /* NEShakeGestureManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A4EF88A1BEB6735000D2D7E /* NEShakeGestureManager.m */; }; 25 | 0A4EF89F1BEB673D000D2D7E /* DemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A4EF89E1BEB673D000D2D7E /* DemoViewController.m */; }; 26 | 0A4EF8A11BEB676C000D2D7E /* libsqlite3.0.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A4EF8A01BEB676C000D2D7E /* libsqlite3.0.tbd */; }; 27 | 0ADE8CFA1BF4999A0096A1E5 /* NEHTTPEyeSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0ADE8CF91BF4999A0096A1E5 /* NEHTTPEyeSettingsViewController.m */; }; 28 | 18EBE1D31D6662D26CDE658E /* libPods-NetworkEye.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B0A88B796892B331322D42D /* libPods-NetworkEye.a */; }; 29 | A18C22DD1D98239A008E40C6 /* NEMapViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A18C22DC1D98239A008E40C6 /* NEMapViewController.m */; }; 30 | EE6CCB621DB1BB6D00EAA45F /* NEKeyboardShortcutManager.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6CCB611DB1BB6D00EAA45F /* NEKeyboardShortcutManager.m */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXContainerItemProxy section */ 34 | 0A4EF85A1BEB66FF000D2D7E /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = 0A4EF8381BEB66FF000D2D7E /* Project object */; 37 | proxyType = 1; 38 | remoteGlobalIDString = 0A4EF83F1BEB66FF000D2D7E; 39 | remoteInfo = NetworkEye; 40 | }; 41 | 0A4EF8651BEB66FF000D2D7E /* PBXContainerItemProxy */ = { 42 | isa = PBXContainerItemProxy; 43 | containerPortal = 0A4EF8381BEB66FF000D2D7E /* Project object */; 44 | proxyType = 1; 45 | remoteGlobalIDString = 0A4EF83F1BEB66FF000D2D7E; 46 | remoteInfo = NetworkEye; 47 | }; 48 | /* End PBXContainerItemProxy section */ 49 | 50 | /* Begin PBXFileReference section */ 51 | 0A09FABE1BF6FC3F0009EC53 /* UIWindow+NEExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIWindow+NEExtension.h"; sourceTree = ""; }; 52 | 0A09FABF1BF6FC3F0009EC53 /* UIWindow+NEExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIWindow+NEExtension.m"; sourceTree = ""; }; 53 | 0A1202E11BF097BC00B710A9 /* NEURLSessionConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NEURLSessionConfiguration.h; sourceTree = ""; }; 54 | 0A1202E21BF097BC00B710A9 /* NEURLSessionConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NEURLSessionConfiguration.m; sourceTree = ""; }; 55 | 0A4EF8401BEB66FF000D2D7E /* NetworkEye.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NetworkEye.app; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | 0A4EF8441BEB66FF000D2D7E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 57 | 0A4EF8461BEB66FF000D2D7E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 58 | 0A4EF8471BEB66FF000D2D7E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 59 | 0A4EF84D1BEB66FF000D2D7E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 60 | 0A4EF84F1BEB66FF000D2D7E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 61 | 0A4EF8521BEB66FF000D2D7E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 62 | 0A4EF8541BEB66FF000D2D7E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 63 | 0A4EF8591BEB66FF000D2D7E /* NetworkEyeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NetworkEyeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 64 | 0A4EF85D1BEB66FF000D2D7E /* NetworkEyeTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NetworkEyeTests.m; sourceTree = ""; }; 65 | 0A4EF85F1BEB66FF000D2D7E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 66 | 0A4EF8641BEB66FF000D2D7E /* NetworkEyeUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NetworkEyeUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 67 | 0A4EF8681BEB66FF000D2D7E /* NetworkEyeUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NetworkEyeUITests.m; sourceTree = ""; }; 68 | 0A4EF86A1BEB66FF000D2D7E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 69 | 0A4EF87F1BEB6735000D2D7E /* NEHTTPEye.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NEHTTPEye.h; sourceTree = ""; }; 70 | 0A4EF8801BEB6735000D2D7E /* NEHTTPEye.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NEHTTPEye.m; sourceTree = ""; }; 71 | 0A4EF8811BEB6735000D2D7E /* NEHTTPEyeDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NEHTTPEyeDetailViewController.h; sourceTree = ""; }; 72 | 0A4EF8821BEB6735000D2D7E /* NEHTTPEyeDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NEHTTPEyeDetailViewController.m; sourceTree = ""; }; 73 | 0A4EF8831BEB6735000D2D7E /* NEHTTPEyeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NEHTTPEyeViewController.h; sourceTree = ""; }; 74 | 0A4EF8841BEB6735000D2D7E /* NEHTTPEyeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NEHTTPEyeViewController.m; sourceTree = ""; }; 75 | 0A4EF8851BEB6735000D2D7E /* NEHTTPModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NEHTTPModel.h; sourceTree = ""; }; 76 | 0A4EF8861BEB6735000D2D7E /* NEHTTPModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NEHTTPModel.m; sourceTree = ""; }; 77 | 0A4EF8871BEB6735000D2D7E /* NEHTTPModelManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NEHTTPModelManager.h; sourceTree = ""; }; 78 | 0A4EF8881BEB6735000D2D7E /* NEHTTPModelManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NEHTTPModelManager.m; sourceTree = ""; }; 79 | 0A4EF8891BEB6735000D2D7E /* NEShakeGestureManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NEShakeGestureManager.h; sourceTree = ""; }; 80 | 0A4EF88A1BEB6735000D2D7E /* NEShakeGestureManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NEShakeGestureManager.m; sourceTree = ""; }; 81 | 0A4EF89D1BEB673D000D2D7E /* DemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoViewController.h; sourceTree = ""; }; 82 | 0A4EF89E1BEB673D000D2D7E /* DemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoViewController.m; sourceTree = ""; }; 83 | 0A4EF8A01BEB676C000D2D7E /* libsqlite3.0.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.0.tbd; path = usr/lib/libsqlite3.0.tbd; sourceTree = SDKROOT; }; 84 | 0ADE8CF81BF4999A0096A1E5 /* NEHTTPEyeSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NEHTTPEyeSettingsViewController.h; sourceTree = ""; }; 85 | 0ADE8CF91BF4999A0096A1E5 /* NEHTTPEyeSettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NEHTTPEyeSettingsViewController.m; sourceTree = ""; }; 86 | 1B0A88B796892B331322D42D /* libPods-NetworkEye.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-NetworkEye.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 87 | 2375E39544CB697EF96E7ACF /* Pods-NetworkEye.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NetworkEye.debug.xcconfig"; path = "Pods/Target Support Files/Pods-NetworkEye/Pods-NetworkEye.debug.xcconfig"; sourceTree = ""; }; 88 | 78F596A72B3544114EDC0FEA /* Pods-NetworkEye.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NetworkEye.release.xcconfig"; path = "Pods/Target Support Files/Pods-NetworkEye/Pods-NetworkEye.release.xcconfig"; sourceTree = ""; }; 89 | A18C22DB1D98239A008E40C6 /* NEMapViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NEMapViewController.h; sourceTree = ""; }; 90 | A18C22DC1D98239A008E40C6 /* NEMapViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NEMapViewController.m; sourceTree = ""; }; 91 | EE6CCB601DB1BB6D00EAA45F /* NEKeyboardShortcutManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NEKeyboardShortcutManager.h; sourceTree = ""; }; 92 | EE6CCB611DB1BB6D00EAA45F /* NEKeyboardShortcutManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NEKeyboardShortcutManager.m; sourceTree = ""; }; 93 | /* End PBXFileReference section */ 94 | 95 | /* Begin PBXFrameworksBuildPhase section */ 96 | 0A4EF83D1BEB66FF000D2D7E /* Frameworks */ = { 97 | isa = PBXFrameworksBuildPhase; 98 | buildActionMask = 2147483647; 99 | files = ( 100 | 0A4EF8A11BEB676C000D2D7E /* libsqlite3.0.tbd in Frameworks */, 101 | 18EBE1D31D6662D26CDE658E /* libPods-NetworkEye.a in Frameworks */, 102 | ); 103 | runOnlyForDeploymentPostprocessing = 0; 104 | }; 105 | 0A4EF8561BEB66FF000D2D7E /* Frameworks */ = { 106 | isa = PBXFrameworksBuildPhase; 107 | buildActionMask = 2147483647; 108 | files = ( 109 | ); 110 | runOnlyForDeploymentPostprocessing = 0; 111 | }; 112 | 0A4EF8611BEB66FF000D2D7E /* Frameworks */ = { 113 | isa = PBXFrameworksBuildPhase; 114 | buildActionMask = 2147483647; 115 | files = ( 116 | ); 117 | runOnlyForDeploymentPostprocessing = 0; 118 | }; 119 | /* End PBXFrameworksBuildPhase section */ 120 | 121 | /* Begin PBXGroup section */ 122 | 0A4EF8371BEB66FF000D2D7E = { 123 | isa = PBXGroup; 124 | children = ( 125 | 0A4EF8421BEB66FF000D2D7E /* NetworkEye */, 126 | 0A4EF85C1BEB66FF000D2D7E /* NetworkEyeTests */, 127 | 0A4EF8671BEB66FF000D2D7E /* NetworkEyeUITests */, 128 | 0A4EF8411BEB66FF000D2D7E /* Products */, 129 | 0A4EF8A21BEB680F000D2D7E /* Frameworks */, 130 | D0D4FDD674CE526CCB04D9A7 /* Pods */, 131 | ); 132 | sourceTree = ""; 133 | }; 134 | 0A4EF8411BEB66FF000D2D7E /* Products */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 0A4EF8401BEB66FF000D2D7E /* NetworkEye.app */, 138 | 0A4EF8591BEB66FF000D2D7E /* NetworkEyeTests.xctest */, 139 | 0A4EF8641BEB66FF000D2D7E /* NetworkEyeUITests.xctest */, 140 | ); 141 | name = Products; 142 | sourceTree = ""; 143 | }; 144 | 0A4EF8421BEB66FF000D2D7E /* NetworkEye */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 0A4EF8761BEB6735000D2D7E /* NetworkEye */, 148 | 0A4EF8461BEB66FF000D2D7E /* AppDelegate.h */, 149 | 0A4EF8471BEB66FF000D2D7E /* AppDelegate.m */, 150 | 0A4EF89D1BEB673D000D2D7E /* DemoViewController.h */, 151 | 0A4EF89E1BEB673D000D2D7E /* DemoViewController.m */, 152 | 0A4EF84C1BEB66FF000D2D7E /* Main.storyboard */, 153 | 0A4EF84F1BEB66FF000D2D7E /* Assets.xcassets */, 154 | 0A4EF8511BEB66FF000D2D7E /* LaunchScreen.storyboard */, 155 | 0A4EF8541BEB66FF000D2D7E /* Info.plist */, 156 | 0A4EF8431BEB66FF000D2D7E /* Supporting Files */, 157 | ); 158 | path = NetworkEye; 159 | sourceTree = ""; 160 | }; 161 | 0A4EF8431BEB66FF000D2D7E /* Supporting Files */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | 0A4EF8441BEB66FF000D2D7E /* main.m */, 165 | ); 166 | name = "Supporting Files"; 167 | sourceTree = ""; 168 | }; 169 | 0A4EF85C1BEB66FF000D2D7E /* NetworkEyeTests */ = { 170 | isa = PBXGroup; 171 | children = ( 172 | 0A4EF85D1BEB66FF000D2D7E /* NetworkEyeTests.m */, 173 | 0A4EF85F1BEB66FF000D2D7E /* Info.plist */, 174 | ); 175 | path = NetworkEyeTests; 176 | sourceTree = ""; 177 | }; 178 | 0A4EF8671BEB66FF000D2D7E /* NetworkEyeUITests */ = { 179 | isa = PBXGroup; 180 | children = ( 181 | 0A4EF8681BEB66FF000D2D7E /* NetworkEyeUITests.m */, 182 | 0A4EF86A1BEB66FF000D2D7E /* Info.plist */, 183 | ); 184 | path = NetworkEyeUITests; 185 | sourceTree = ""; 186 | }; 187 | 0A4EF8761BEB6735000D2D7E /* NetworkEye */ = { 188 | isa = PBXGroup; 189 | children = ( 190 | 0A4EF87F1BEB6735000D2D7E /* NEHTTPEye.h */, 191 | 0A4EF8801BEB6735000D2D7E /* NEHTTPEye.m */, 192 | 0A4EF8811BEB6735000D2D7E /* NEHTTPEyeDetailViewController.h */, 193 | 0A4EF8821BEB6735000D2D7E /* NEHTTPEyeDetailViewController.m */, 194 | A18C22DB1D98239A008E40C6 /* NEMapViewController.h */, 195 | A18C22DC1D98239A008E40C6 /* NEMapViewController.m */, 196 | 0A4EF8831BEB6735000D2D7E /* NEHTTPEyeViewController.h */, 197 | 0A4EF8841BEB6735000D2D7E /* NEHTTPEyeViewController.m */, 198 | 0ADE8CF81BF4999A0096A1E5 /* NEHTTPEyeSettingsViewController.h */, 199 | 0ADE8CF91BF4999A0096A1E5 /* NEHTTPEyeSettingsViewController.m */, 200 | 0A4EF8851BEB6735000D2D7E /* NEHTTPModel.h */, 201 | 0A4EF8861BEB6735000D2D7E /* NEHTTPModel.m */, 202 | 0A4EF8871BEB6735000D2D7E /* NEHTTPModelManager.h */, 203 | 0A4EF8881BEB6735000D2D7E /* NEHTTPModelManager.m */, 204 | 0A4EF8891BEB6735000D2D7E /* NEShakeGestureManager.h */, 205 | 0A4EF88A1BEB6735000D2D7E /* NEShakeGestureManager.m */, 206 | 0A09FABE1BF6FC3F0009EC53 /* UIWindow+NEExtension.h */, 207 | 0A09FABF1BF6FC3F0009EC53 /* UIWindow+NEExtension.m */, 208 | 0A1202E11BF097BC00B710A9 /* NEURLSessionConfiguration.h */, 209 | 0A1202E21BF097BC00B710A9 /* NEURLSessionConfiguration.m */, 210 | EE6CCB601DB1BB6D00EAA45F /* NEKeyboardShortcutManager.h */, 211 | EE6CCB611DB1BB6D00EAA45F /* NEKeyboardShortcutManager.m */, 212 | ); 213 | path = NetworkEye; 214 | sourceTree = ""; 215 | }; 216 | 0A4EF8A21BEB680F000D2D7E /* Frameworks */ = { 217 | isa = PBXGroup; 218 | children = ( 219 | 0A4EF8A01BEB676C000D2D7E /* libsqlite3.0.tbd */, 220 | 1B0A88B796892B331322D42D /* libPods-NetworkEye.a */, 221 | ); 222 | name = Frameworks; 223 | sourceTree = ""; 224 | }; 225 | D0D4FDD674CE526CCB04D9A7 /* Pods */ = { 226 | isa = PBXGroup; 227 | children = ( 228 | 2375E39544CB697EF96E7ACF /* Pods-NetworkEye.debug.xcconfig */, 229 | 78F596A72B3544114EDC0FEA /* Pods-NetworkEye.release.xcconfig */, 230 | ); 231 | name = Pods; 232 | sourceTree = ""; 233 | }; 234 | /* End PBXGroup section */ 235 | 236 | /* Begin PBXNativeTarget section */ 237 | 0A4EF83F1BEB66FF000D2D7E /* NetworkEye */ = { 238 | isa = PBXNativeTarget; 239 | buildConfigurationList = 0A4EF86D1BEB66FF000D2D7E /* Build configuration list for PBXNativeTarget "NetworkEye" */; 240 | buildPhases = ( 241 | 1E47BF57E219846EA68141A1 /* [CP] Check Pods Manifest.lock */, 242 | A770EAC8FB7D5B8B9B0CE23A /* 📦 Check Pods Manifest.lock */, 243 | 0A4EF83C1BEB66FF000D2D7E /* Sources */, 244 | 0A4EF83D1BEB66FF000D2D7E /* Frameworks */, 245 | 0A4EF83E1BEB66FF000D2D7E /* Resources */, 246 | ); 247 | buildRules = ( 248 | ); 249 | dependencies = ( 250 | ); 251 | name = NetworkEye; 252 | productName = NetworkEye; 253 | productReference = 0A4EF8401BEB66FF000D2D7E /* NetworkEye.app */; 254 | productType = "com.apple.product-type.application"; 255 | }; 256 | 0A4EF8581BEB66FF000D2D7E /* NetworkEyeTests */ = { 257 | isa = PBXNativeTarget; 258 | buildConfigurationList = 0A4EF8701BEB66FF000D2D7E /* Build configuration list for PBXNativeTarget "NetworkEyeTests" */; 259 | buildPhases = ( 260 | 0A4EF8551BEB66FF000D2D7E /* Sources */, 261 | 0A4EF8561BEB66FF000D2D7E /* Frameworks */, 262 | 0A4EF8571BEB66FF000D2D7E /* Resources */, 263 | ); 264 | buildRules = ( 265 | ); 266 | dependencies = ( 267 | 0A4EF85B1BEB66FF000D2D7E /* PBXTargetDependency */, 268 | ); 269 | name = NetworkEyeTests; 270 | productName = NetworkEyeTests; 271 | productReference = 0A4EF8591BEB66FF000D2D7E /* NetworkEyeTests.xctest */; 272 | productType = "com.apple.product-type.bundle.unit-test"; 273 | }; 274 | 0A4EF8631BEB66FF000D2D7E /* NetworkEyeUITests */ = { 275 | isa = PBXNativeTarget; 276 | buildConfigurationList = 0A4EF8731BEB66FF000D2D7E /* Build configuration list for PBXNativeTarget "NetworkEyeUITests" */; 277 | buildPhases = ( 278 | 0A4EF8601BEB66FF000D2D7E /* Sources */, 279 | 0A4EF8611BEB66FF000D2D7E /* Frameworks */, 280 | 0A4EF8621BEB66FF000D2D7E /* Resources */, 281 | ); 282 | buildRules = ( 283 | ); 284 | dependencies = ( 285 | 0A4EF8661BEB66FF000D2D7E /* PBXTargetDependency */, 286 | ); 287 | name = NetworkEyeUITests; 288 | productName = NetworkEyeUITests; 289 | productReference = 0A4EF8641BEB66FF000D2D7E /* NetworkEyeUITests.xctest */; 290 | productType = "com.apple.product-type.bundle.ui-testing"; 291 | }; 292 | /* End PBXNativeTarget section */ 293 | 294 | /* Begin PBXProject section */ 295 | 0A4EF8381BEB66FF000D2D7E /* Project object */ = { 296 | isa = PBXProject; 297 | attributes = { 298 | LastUpgradeCheck = 0700; 299 | ORGANIZATIONNAME = coderyi; 300 | TargetAttributes = { 301 | 0A4EF83F1BEB66FF000D2D7E = { 302 | CreatedOnToolsVersion = 7.0.1; 303 | }; 304 | 0A4EF8581BEB66FF000D2D7E = { 305 | CreatedOnToolsVersion = 7.0.1; 306 | TestTargetID = 0A4EF83F1BEB66FF000D2D7E; 307 | }; 308 | 0A4EF8631BEB66FF000D2D7E = { 309 | CreatedOnToolsVersion = 7.0.1; 310 | TestTargetID = 0A4EF83F1BEB66FF000D2D7E; 311 | }; 312 | }; 313 | }; 314 | buildConfigurationList = 0A4EF83B1BEB66FF000D2D7E /* Build configuration list for PBXProject "NetworkEye" */; 315 | compatibilityVersion = "Xcode 3.2"; 316 | developmentRegion = English; 317 | hasScannedForEncodings = 0; 318 | knownRegions = ( 319 | English, 320 | en, 321 | Base, 322 | ); 323 | mainGroup = 0A4EF8371BEB66FF000D2D7E; 324 | productRefGroup = 0A4EF8411BEB66FF000D2D7E /* Products */; 325 | projectDirPath = ""; 326 | projectRoot = ""; 327 | targets = ( 328 | 0A4EF83F1BEB66FF000D2D7E /* NetworkEye */, 329 | 0A4EF8581BEB66FF000D2D7E /* NetworkEyeTests */, 330 | 0A4EF8631BEB66FF000D2D7E /* NetworkEyeUITests */, 331 | ); 332 | }; 333 | /* End PBXProject section */ 334 | 335 | /* Begin PBXResourcesBuildPhase section */ 336 | 0A4EF83E1BEB66FF000D2D7E /* Resources */ = { 337 | isa = PBXResourcesBuildPhase; 338 | buildActionMask = 2147483647; 339 | files = ( 340 | 0A4EF8531BEB66FF000D2D7E /* LaunchScreen.storyboard in Resources */, 341 | 0A4EF8501BEB66FF000D2D7E /* Assets.xcassets in Resources */, 342 | 0A4EF84E1BEB66FF000D2D7E /* Main.storyboard in Resources */, 343 | ); 344 | runOnlyForDeploymentPostprocessing = 0; 345 | }; 346 | 0A4EF8571BEB66FF000D2D7E /* Resources */ = { 347 | isa = PBXResourcesBuildPhase; 348 | buildActionMask = 2147483647; 349 | files = ( 350 | ); 351 | runOnlyForDeploymentPostprocessing = 0; 352 | }; 353 | 0A4EF8621BEB66FF000D2D7E /* Resources */ = { 354 | isa = PBXResourcesBuildPhase; 355 | buildActionMask = 2147483647; 356 | files = ( 357 | ); 358 | runOnlyForDeploymentPostprocessing = 0; 359 | }; 360 | /* End PBXResourcesBuildPhase section */ 361 | 362 | /* Begin PBXShellScriptBuildPhase section */ 363 | 1E47BF57E219846EA68141A1 /* [CP] Check Pods Manifest.lock */ = { 364 | isa = PBXShellScriptBuildPhase; 365 | buildActionMask = 2147483647; 366 | files = ( 367 | ); 368 | inputPaths = ( 369 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 370 | "${PODS_ROOT}/Manifest.lock", 371 | ); 372 | name = "[CP] Check Pods Manifest.lock"; 373 | outputPaths = ( 374 | "$(DERIVED_FILE_DIR)/Pods-NetworkEye-checkManifestLockResult.txt", 375 | ); 376 | runOnlyForDeploymentPostprocessing = 0; 377 | shellPath = /bin/sh; 378 | 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"; 379 | showEnvVarsInLog = 0; 380 | }; 381 | A770EAC8FB7D5B8B9B0CE23A /* 📦 Check Pods Manifest.lock */ = { 382 | isa = PBXShellScriptBuildPhase; 383 | buildActionMask = 2147483647; 384 | files = ( 385 | ); 386 | inputPaths = ( 387 | ); 388 | name = "📦 Check Pods Manifest.lock"; 389 | outputPaths = ( 390 | ); 391 | runOnlyForDeploymentPostprocessing = 0; 392 | shellPath = /bin/sh; 393 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 394 | showEnvVarsInLog = 0; 395 | }; 396 | /* End PBXShellScriptBuildPhase section */ 397 | 398 | /* Begin PBXSourcesBuildPhase section */ 399 | 0A4EF83C1BEB66FF000D2D7E /* Sources */ = { 400 | isa = PBXSourcesBuildPhase; 401 | buildActionMask = 2147483647; 402 | files = ( 403 | 0A1202E31BF097BC00B710A9 /* NEURLSessionConfiguration.m in Sources */, 404 | 0A4EF8951BEB6735000D2D7E /* NEHTTPEye.m in Sources */, 405 | 0A4EF89A1BEB6735000D2D7E /* NEShakeGestureManager.m in Sources */, 406 | A18C22DD1D98239A008E40C6 /* NEMapViewController.m in Sources */, 407 | 0A4EF8481BEB66FF000D2D7E /* AppDelegate.m in Sources */, 408 | 0A4EF89F1BEB673D000D2D7E /* DemoViewController.m in Sources */, 409 | 0A4EF8451BEB66FF000D2D7E /* main.m in Sources */, 410 | 0A4EF8981BEB6735000D2D7E /* NEHTTPModel.m in Sources */, 411 | 0A4EF8961BEB6735000D2D7E /* NEHTTPEyeDetailViewController.m in Sources */, 412 | EE6CCB621DB1BB6D00EAA45F /* NEKeyboardShortcutManager.m in Sources */, 413 | 0A4EF8971BEB6735000D2D7E /* NEHTTPEyeViewController.m in Sources */, 414 | 0A4EF8991BEB6735000D2D7E /* NEHTTPModelManager.m in Sources */, 415 | 0ADE8CFA1BF4999A0096A1E5 /* NEHTTPEyeSettingsViewController.m in Sources */, 416 | 0A09FAC01BF6FC3F0009EC53 /* UIWindow+NEExtension.m in Sources */, 417 | ); 418 | runOnlyForDeploymentPostprocessing = 0; 419 | }; 420 | 0A4EF8551BEB66FF000D2D7E /* Sources */ = { 421 | isa = PBXSourcesBuildPhase; 422 | buildActionMask = 2147483647; 423 | files = ( 424 | 0A4EF85E1BEB66FF000D2D7E /* NetworkEyeTests.m in Sources */, 425 | ); 426 | runOnlyForDeploymentPostprocessing = 0; 427 | }; 428 | 0A4EF8601BEB66FF000D2D7E /* Sources */ = { 429 | isa = PBXSourcesBuildPhase; 430 | buildActionMask = 2147483647; 431 | files = ( 432 | 0A4EF8691BEB66FF000D2D7E /* NetworkEyeUITests.m in Sources */, 433 | ); 434 | runOnlyForDeploymentPostprocessing = 0; 435 | }; 436 | /* End PBXSourcesBuildPhase section */ 437 | 438 | /* Begin PBXTargetDependency section */ 439 | 0A4EF85B1BEB66FF000D2D7E /* PBXTargetDependency */ = { 440 | isa = PBXTargetDependency; 441 | target = 0A4EF83F1BEB66FF000D2D7E /* NetworkEye */; 442 | targetProxy = 0A4EF85A1BEB66FF000D2D7E /* PBXContainerItemProxy */; 443 | }; 444 | 0A4EF8661BEB66FF000D2D7E /* PBXTargetDependency */ = { 445 | isa = PBXTargetDependency; 446 | target = 0A4EF83F1BEB66FF000D2D7E /* NetworkEye */; 447 | targetProxy = 0A4EF8651BEB66FF000D2D7E /* PBXContainerItemProxy */; 448 | }; 449 | /* End PBXTargetDependency section */ 450 | 451 | /* Begin PBXVariantGroup section */ 452 | 0A4EF84C1BEB66FF000D2D7E /* Main.storyboard */ = { 453 | isa = PBXVariantGroup; 454 | children = ( 455 | 0A4EF84D1BEB66FF000D2D7E /* Base */, 456 | ); 457 | name = Main.storyboard; 458 | sourceTree = ""; 459 | }; 460 | 0A4EF8511BEB66FF000D2D7E /* LaunchScreen.storyboard */ = { 461 | isa = PBXVariantGroup; 462 | children = ( 463 | 0A4EF8521BEB66FF000D2D7E /* Base */, 464 | ); 465 | name = LaunchScreen.storyboard; 466 | sourceTree = ""; 467 | }; 468 | /* End PBXVariantGroup section */ 469 | 470 | /* Begin XCBuildConfiguration section */ 471 | 0A4EF86B1BEB66FF000D2D7E /* Debug */ = { 472 | isa = XCBuildConfiguration; 473 | buildSettings = { 474 | ALWAYS_SEARCH_USER_PATHS = NO; 475 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 476 | CLANG_CXX_LIBRARY = "libc++"; 477 | CLANG_ENABLE_MODULES = YES; 478 | CLANG_ENABLE_OBJC_ARC = YES; 479 | CLANG_WARN_BOOL_CONVERSION = YES; 480 | CLANG_WARN_CONSTANT_CONVERSION = YES; 481 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 482 | CLANG_WARN_EMPTY_BODY = YES; 483 | CLANG_WARN_ENUM_CONVERSION = YES; 484 | CLANG_WARN_INT_CONVERSION = YES; 485 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 486 | CLANG_WARN_UNREACHABLE_CODE = YES; 487 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 488 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 489 | COPY_PHASE_STRIP = NO; 490 | DEBUG_INFORMATION_FORMAT = dwarf; 491 | ENABLE_STRICT_OBJC_MSGSEND = YES; 492 | ENABLE_TESTABILITY = YES; 493 | GCC_C_LANGUAGE_STANDARD = gnu99; 494 | GCC_DYNAMIC_NO_PIC = NO; 495 | GCC_NO_COMMON_BLOCKS = YES; 496 | GCC_OPTIMIZATION_LEVEL = 0; 497 | GCC_PREPROCESSOR_DEFINITIONS = ( 498 | "DEBUG=1", 499 | "$(inherited)", 500 | ); 501 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 502 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 503 | GCC_WARN_UNDECLARED_SELECTOR = YES; 504 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 505 | GCC_WARN_UNUSED_FUNCTION = YES; 506 | GCC_WARN_UNUSED_VARIABLE = YES; 507 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 508 | MTL_ENABLE_DEBUG_INFO = YES; 509 | ONLY_ACTIVE_ARCH = YES; 510 | SDKROOT = iphoneos; 511 | }; 512 | name = Debug; 513 | }; 514 | 0A4EF86C1BEB66FF000D2D7E /* Release */ = { 515 | isa = XCBuildConfiguration; 516 | buildSettings = { 517 | ALWAYS_SEARCH_USER_PATHS = NO; 518 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 519 | CLANG_CXX_LIBRARY = "libc++"; 520 | CLANG_ENABLE_MODULES = YES; 521 | CLANG_ENABLE_OBJC_ARC = YES; 522 | CLANG_WARN_BOOL_CONVERSION = YES; 523 | CLANG_WARN_CONSTANT_CONVERSION = YES; 524 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 525 | CLANG_WARN_EMPTY_BODY = YES; 526 | CLANG_WARN_ENUM_CONVERSION = YES; 527 | CLANG_WARN_INT_CONVERSION = YES; 528 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 529 | CLANG_WARN_UNREACHABLE_CODE = YES; 530 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 531 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 532 | COPY_PHASE_STRIP = NO; 533 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 534 | ENABLE_NS_ASSERTIONS = NO; 535 | ENABLE_STRICT_OBJC_MSGSEND = YES; 536 | GCC_C_LANGUAGE_STANDARD = gnu99; 537 | GCC_NO_COMMON_BLOCKS = YES; 538 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 539 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 540 | GCC_WARN_UNDECLARED_SELECTOR = YES; 541 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 542 | GCC_WARN_UNUSED_FUNCTION = YES; 543 | GCC_WARN_UNUSED_VARIABLE = YES; 544 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 545 | MTL_ENABLE_DEBUG_INFO = NO; 546 | SDKROOT = iphoneos; 547 | VALIDATE_PRODUCT = YES; 548 | }; 549 | name = Release; 550 | }; 551 | 0A4EF86E1BEB66FF000D2D7E /* Debug */ = { 552 | isa = XCBuildConfiguration; 553 | baseConfigurationReference = 2375E39544CB697EF96E7ACF /* Pods-NetworkEye.debug.xcconfig */; 554 | buildSettings = { 555 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 556 | INFOPLIST_FILE = NetworkEye/Info.plist; 557 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 558 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 559 | OTHER_CFLAGS = ( 560 | "$(inherited)", 561 | "-DSQLITE_HAS_CODEC", 562 | "-DHAVE_USLEEP=1", 563 | "$(inherited)", 564 | "-DSQLITE_HAS_CODEC", 565 | "-DSQLITE_TEMP_STORE=2", 566 | "-DSQLITE_THREADSAFE", 567 | "-DSQLCIPHER_CRYPTO_CC", 568 | "$(inherited)", 569 | "-isystem", 570 | "\"${PODS_ROOT}/Headers/Public\"", 571 | "-isystem", 572 | "\"${PODS_ROOT}/Headers/Public/FMDB\"", 573 | "-isystem", 574 | "\"${PODS_ROOT}/Headers/Public/SQLCipher\"", 575 | ); 576 | PRODUCT_BUNDLE_IDENTIFIER = coderyi.NetworkEye; 577 | PRODUCT_NAME = "$(TARGET_NAME)"; 578 | }; 579 | name = Debug; 580 | }; 581 | 0A4EF86F1BEB66FF000D2D7E /* Release */ = { 582 | isa = XCBuildConfiguration; 583 | baseConfigurationReference = 78F596A72B3544114EDC0FEA /* Pods-NetworkEye.release.xcconfig */; 584 | buildSettings = { 585 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 586 | INFOPLIST_FILE = NetworkEye/Info.plist; 587 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 588 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 589 | OTHER_CFLAGS = ( 590 | "$(inherited)", 591 | "-DSQLITE_HAS_CODEC", 592 | "-DHAVE_USLEEP=1", 593 | "$(inherited)", 594 | "-DSQLITE_HAS_CODEC", 595 | "-DSQLITE_TEMP_STORE=2", 596 | "-DSQLITE_THREADSAFE", 597 | "-DSQLCIPHER_CRYPTO_CC", 598 | "$(inherited)", 599 | "-isystem", 600 | "\"${PODS_ROOT}/Headers/Public\"", 601 | "-isystem", 602 | "\"${PODS_ROOT}/Headers/Public/FMDB\"", 603 | "-isystem", 604 | "\"${PODS_ROOT}/Headers/Public/SQLCipher\"", 605 | ); 606 | PRODUCT_BUNDLE_IDENTIFIER = coderyi.NetworkEye; 607 | PRODUCT_NAME = "$(TARGET_NAME)"; 608 | }; 609 | name = Release; 610 | }; 611 | 0A4EF8711BEB66FF000D2D7E /* Debug */ = { 612 | isa = XCBuildConfiguration; 613 | buildSettings = { 614 | BUNDLE_LOADER = "$(TEST_HOST)"; 615 | INFOPLIST_FILE = NetworkEyeTests/Info.plist; 616 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 617 | PRODUCT_BUNDLE_IDENTIFIER = coderyi.NetworkEyeTests; 618 | PRODUCT_NAME = "$(TARGET_NAME)"; 619 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NetworkEye.app/NetworkEye"; 620 | }; 621 | name = Debug; 622 | }; 623 | 0A4EF8721BEB66FF000D2D7E /* Release */ = { 624 | isa = XCBuildConfiguration; 625 | buildSettings = { 626 | BUNDLE_LOADER = "$(TEST_HOST)"; 627 | INFOPLIST_FILE = NetworkEyeTests/Info.plist; 628 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 629 | PRODUCT_BUNDLE_IDENTIFIER = coderyi.NetworkEyeTests; 630 | PRODUCT_NAME = "$(TARGET_NAME)"; 631 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NetworkEye.app/NetworkEye"; 632 | }; 633 | name = Release; 634 | }; 635 | 0A4EF8741BEB66FF000D2D7E /* Debug */ = { 636 | isa = XCBuildConfiguration; 637 | buildSettings = { 638 | INFOPLIST_FILE = NetworkEyeUITests/Info.plist; 639 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 640 | PRODUCT_BUNDLE_IDENTIFIER = coderyi.NetworkEyeUITests; 641 | PRODUCT_NAME = "$(TARGET_NAME)"; 642 | TEST_TARGET_NAME = NetworkEye; 643 | USES_XCTRUNNER = YES; 644 | }; 645 | name = Debug; 646 | }; 647 | 0A4EF8751BEB66FF000D2D7E /* Release */ = { 648 | isa = XCBuildConfiguration; 649 | buildSettings = { 650 | INFOPLIST_FILE = NetworkEyeUITests/Info.plist; 651 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 652 | PRODUCT_BUNDLE_IDENTIFIER = coderyi.NetworkEyeUITests; 653 | PRODUCT_NAME = "$(TARGET_NAME)"; 654 | TEST_TARGET_NAME = NetworkEye; 655 | USES_XCTRUNNER = YES; 656 | }; 657 | name = Release; 658 | }; 659 | /* End XCBuildConfiguration section */ 660 | 661 | /* Begin XCConfigurationList section */ 662 | 0A4EF83B1BEB66FF000D2D7E /* Build configuration list for PBXProject "NetworkEye" */ = { 663 | isa = XCConfigurationList; 664 | buildConfigurations = ( 665 | 0A4EF86B1BEB66FF000D2D7E /* Debug */, 666 | 0A4EF86C1BEB66FF000D2D7E /* Release */, 667 | ); 668 | defaultConfigurationIsVisible = 0; 669 | defaultConfigurationName = Release; 670 | }; 671 | 0A4EF86D1BEB66FF000D2D7E /* Build configuration list for PBXNativeTarget "NetworkEye" */ = { 672 | isa = XCConfigurationList; 673 | buildConfigurations = ( 674 | 0A4EF86E1BEB66FF000D2D7E /* Debug */, 675 | 0A4EF86F1BEB66FF000D2D7E /* Release */, 676 | ); 677 | defaultConfigurationIsVisible = 0; 678 | defaultConfigurationName = Release; 679 | }; 680 | 0A4EF8701BEB66FF000D2D7E /* Build configuration list for PBXNativeTarget "NetworkEyeTests" */ = { 681 | isa = XCConfigurationList; 682 | buildConfigurations = ( 683 | 0A4EF8711BEB66FF000D2D7E /* Debug */, 684 | 0A4EF8721BEB66FF000D2D7E /* Release */, 685 | ); 686 | defaultConfigurationIsVisible = 0; 687 | defaultConfigurationName = Release; 688 | }; 689 | 0A4EF8731BEB66FF000D2D7E /* Build configuration list for PBXNativeTarget "NetworkEyeUITests" */ = { 690 | isa = XCConfigurationList; 691 | buildConfigurations = ( 692 | 0A4EF8741BEB66FF000D2D7E /* Debug */, 693 | 0A4EF8751BEB66FF000D2D7E /* Release */, 694 | ); 695 | defaultConfigurationIsVisible = 0; 696 | defaultConfigurationName = Release; 697 | }; 698 | /* End XCConfigurationList section */ 699 | }; 700 | rootObject = 0A4EF8381BEB66FF000D2D7E /* Project object */; 701 | } 702 | -------------------------------------------------------------------------------- /NetworkEye.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /NetworkEye.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /NetworkEye.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /NetworkEye/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/5. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /NetworkEye/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/5. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "DemoViewController.h" 11 | #import "NEHTTPEye.h" 12 | #import "NetworkEye/NEHTTPModelManager.h" 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 21 | // Override point for customization after application launch. 22 | #if defined(DEBUG)||defined(_DEBUG) 23 | [NEHTTPEye setEnabled:YES]; 24 | #endif 25 | 26 | UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:[[DemoViewController alloc] init]]; 27 | nav.navigationBar.barTintColor=[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f]; 28 | nav.navigationBar.titleTextAttributes=[NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName]; 29 | self.window.rootViewController=nav; 30 | return YES; 31 | } 32 | 33 | - (void)applicationWillResignActive:(UIApplication *)application { 34 | // 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. 35 | // 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. 36 | } 37 | 38 | - (void)applicationDidEnterBackground:(UIApplication *)application { 39 | // 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. 40 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 41 | } 42 | 43 | - (void)applicationWillEnterForeground:(UIApplication *)application { 44 | // 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. 45 | } 46 | 47 | - (void)applicationDidBecomeActive:(UIApplication *)application { 48 | // 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. 49 | } 50 | 51 | - (void)applicationWillTerminate:(UIApplication *)application { 52 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /NetworkEye/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /NetworkEye/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 | -------------------------------------------------------------------------------- /NetworkEye/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 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /NetworkEye/DemoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DemoViewController.h 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/5. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DemoViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NetworkEye/DemoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DemoViewController.m 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/5. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "DemoViewController.h" 10 | 11 | #import "NEHTTPEye.h" 12 | #import "NEHTTPEyeViewController.h" 13 | 14 | @interface DemoViewController () 15 | 16 | @end 17 | 18 | @implementation DemoViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | // Do any additional setup after loading the view, typically from a nib. 23 | [self setupView]; 24 | [self testRequest]; 25 | 26 | } 27 | 28 | - (void)setupView{ 29 | 30 | if ([[[UIDevice currentDevice]systemVersion] floatValue] >= 7.0) { 31 | self.edgesForExtendedLayout = UIRectEdgeBottom | UIRectEdgeLeft | UIRectEdgeRight; 32 | 33 | } 34 | self.automaticallyAdjustsScrollViewInsets=NO; 35 | self.view.backgroundColor=[UIColor whiteColor]; 36 | self.title=@"NetworkEye"; 37 | self.view.backgroundColor=[UIColor whiteColor]; 38 | 39 | UILabel *label=[[UILabel alloc] initWithFrame:CGRectMake(10, 20, [[UIScreen mainScreen] bounds].size.width-20, 45)]; 40 | [self.view addSubview:label]; 41 | label.textColor=[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f]; 42 | label.font=[UIFont systemFontOfSize:12]; 43 | label.numberOfLines=0; 44 | label.text=@"NetworkEye - a iOS network debug library"; 45 | label.textAlignment=NSTextAlignmentCenter; 46 | 47 | UIButton *btGoMonitorViewController=[UIButton buttonWithType:UIButtonTypeCustom]; 48 | [self.view addSubview:btGoMonitorViewController]; 49 | [btGoMonitorViewController addTarget:self action:@selector(goMonitorAction) forControlEvents:UIControlEventTouchUpInside]; 50 | btGoMonitorViewController.frame=CGRectMake(([[UIScreen mainScreen] bounds].size.width-160)/2, 80, 160, 45); 51 | [btGoMonitorViewController setTitle:@"Go NetworkEye" forState:UIControlStateNormal]; 52 | [btGoMonitorViewController setTitleColor:[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f] forState:UIControlStateNormal]; 53 | btGoMonitorViewController.layer.borderColor=[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f].CGColor; 54 | btGoMonitorViewController.layer.borderWidth=0.4; 55 | 56 | 57 | UIButton *btRightRequest=[UIButton buttonWithType:UIButtonTypeCustom]; 58 | [self.view addSubview:btRightRequest]; 59 | [btRightRequest addTarget:self action:@selector(btRightRequestAction) forControlEvents:UIControlEventTouchUpInside]; 60 | btRightRequest.frame=CGRectMake(([[UIScreen mainScreen] bounds].size.width-190)/2, 160, 190, 35); 61 | [btRightRequest setTitle:@"Click to right request" forState:UIControlStateNormal]; 62 | [btRightRequest setTitleColor:[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f] forState:UIControlStateNormal]; 63 | btRightRequest.layer.borderColor=[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f].CGColor; 64 | btRightRequest.layer.borderWidth=0.4; 65 | btRightRequest.titleLabel.font=[UIFont systemFontOfSize:15]; 66 | 67 | UIButton *btErrorRequest=[UIButton buttonWithType:UIButtonTypeCustom]; 68 | [self.view addSubview:btErrorRequest]; 69 | [btErrorRequest addTarget:self action:@selector(btErrorRequestAction) forControlEvents:UIControlEventTouchUpInside]; 70 | btErrorRequest.frame=CGRectMake(([[UIScreen mainScreen] bounds].size.width-190)/2, 200, 190, 35); 71 | [btErrorRequest setTitle:@"Click to error request" forState:UIControlStateNormal]; 72 | [btErrorRequest setTitleColor:[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f] forState:UIControlStateNormal]; 73 | btErrorRequest.layer.borderColor=[UIColor colorWithRed:0.9 green:0.31 blue:0.28 alpha:1].CGColor; 74 | btErrorRequest.layer.borderWidth=0.4; 75 | btErrorRequest.titleLabel.font=[UIFont systemFontOfSize:15]; 76 | 77 | UIButton *btSessionRequest=[UIButton buttonWithType:UIButtonTypeCustom]; 78 | [self.view addSubview:btSessionRequest]; 79 | [btSessionRequest addTarget:self action:@selector(btSessionRequestAction) forControlEvents:UIControlEventTouchUpInside]; 80 | btSessionRequest.frame=CGRectMake(([[UIScreen mainScreen] bounds].size.width-190)/2, 240, 190, 35); 81 | [btSessionRequest setTitle:@"Click to session request" forState:UIControlStateNormal]; 82 | [btSessionRequest setTitleColor:[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f] forState:UIControlStateNormal]; 83 | btSessionRequest.layer.borderColor=[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f].CGColor; 84 | btSessionRequest.layer.borderWidth=0.4; 85 | btSessionRequest.titleLabel.font=[UIFont systemFontOfSize:15]; 86 | 87 | 88 | UIButton *btURLConnectionOfPostRequest=[UIButton buttonWithType:UIButtonTypeCustom]; 89 | [self.view addSubview:btURLConnectionOfPostRequest]; 90 | [btURLConnectionOfPostRequest addTarget:self action:@selector(btURLConnectionOfPOSTRequestAction) forControlEvents:UIControlEventTouchUpInside]; 91 | btURLConnectionOfPostRequest.frame=CGRectMake(([[UIScreen mainScreen] bounds].size.width-300)/2, 280, 300, 35); 92 | [btURLConnectionOfPostRequest setTitle:@"Click to NSURLConnection Post request" forState:UIControlStateNormal]; 93 | [btURLConnectionOfPostRequest setTitleColor:[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f] forState:UIControlStateNormal]; 94 | btURLConnectionOfPostRequest.layer.borderColor=[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f].CGColor; 95 | btURLConnectionOfPostRequest.layer.borderWidth=0.4; 96 | btURLConnectionOfPostRequest.titleLabel.font=[UIFont systemFontOfSize:15]; 97 | 98 | 99 | UIButton *btNSURLSessionOfPostRequest=[UIButton buttonWithType:UIButtonTypeCustom]; 100 | [self.view addSubview:btNSURLSessionOfPostRequest]; 101 | [btNSURLSessionOfPostRequest addTarget:self action:@selector(btNSURLSessionOfPOSTRequestAction) forControlEvents:UIControlEventTouchUpInside]; 102 | btNSURLSessionOfPostRequest.frame=CGRectMake(([[UIScreen mainScreen] bounds].size.width-300)/2, 310, 300, 35); 103 | [btNSURLSessionOfPostRequest setTitle:@"Click to NSURLSession Post request" forState:UIControlStateNormal]; 104 | [btNSURLSessionOfPostRequest setTitleColor:[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f] forState:UIControlStateNormal]; 105 | btNSURLSessionOfPostRequest.layer.borderColor=[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f].CGColor; 106 | btNSURLSessionOfPostRequest.layer.borderWidth=0.4; 107 | btNSURLSessionOfPostRequest.titleLabel.font=[UIFont systemFontOfSize:15]; 108 | 109 | 110 | UIWebView *webView=[[UIWebView alloc] initWithFrame:CGRectMake(0, 360, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height-64-360)]; 111 | [self.view addSubview:webView]; 112 | [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://www.github.com"]]]; 113 | 114 | } 115 | 116 | - (void)goMonitorAction{ 117 | 118 | #if defined(DEBUG)||defined(_DEBUG) 119 | NEHTTPEyeViewController *vc=[[NEHTTPEyeViewController alloc] init]; 120 | [self presentViewController:vc animated:YES completion:nil]; 121 | #endif 122 | 123 | 124 | } 125 | 126 | #pragma clang diagnostic push 127 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 128 | - (void)btRightRequestAction{ 129 | 130 | [NSURLConnection sendAsynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://api.github.com/search/users?q=language:objective-c&sort=followers&order=desc"]] queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { 131 | }]; 132 | 133 | } 134 | 135 | - (void)btErrorRequestAction{ 136 | 137 | [NSURLConnection sendAsynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://api.github.com/yy"]] queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { 138 | }]; 139 | 140 | } 141 | - (void)btSessionRequestAction{ 142 | 143 | NSURL *url = [NSURL URLWithString:@"http://www.example.com"]; 144 | NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration]; 145 | // config.protocolClasses=@[[NEHTTPEye class]];//在NEURLSessionConfiguration里面注册了,所以不用在这里重复注册了 146 | 147 | NSURLSession *urlsession = [NSURLSession sessionWithConfiguration:config]; 148 | 149 | NSURLSessionDataTask *datatask = [urlsession dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { 150 | if(error) { 151 | NSLog(@"error: %@", error); 152 | } 153 | else { 154 | NSLog(@"Success"); 155 | } 156 | }]; 157 | [datatask resume]; 158 | 159 | 160 | NSURLSessionDataTask *datatask1 = [[NSURLSession sharedSession] dataTaskWithURL:[NSURL URLWithString:@"http://www.example1.com"] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { 161 | if(error) { 162 | NSLog(@"error: %@", error); 163 | } 164 | else { 165 | NSLog(@"Success"); 166 | } 167 | }]; 168 | [datatask1 resume]; 169 | 170 | } 171 | 172 | - (void)btURLConnectionOfPOSTRequestAction{ 173 | 174 | NSURL *url = [NSURL URLWithString:@"http://www.example.com"]; 175 | 176 | NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; 177 | request.timeoutInterval = 10; 178 | request.HTTPMethod = @"POST"; 179 | 180 | request.HTTPBody = [@"name=NetworkEye&password=123456" dataUsingEncoding:NSUTF8StringEncoding]; 181 | 182 | NSOperationQueue *queue = [NSOperationQueue mainQueue]; 183 | [NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { 184 | NSLog(@"返回数据-%@",data); 185 | }]; 186 | } 187 | 188 | - (void)btNSURLSessionOfPOSTRequestAction{ 189 | NSURL *url = [NSURL URLWithString:@"http://www.example.com"]; 190 | NSMutableURLRequest *mutableRequest = [NSMutableURLRequest requestWithURL:url]; 191 | NSString *bobyString = @"name=NetworkEye&password=123456"; 192 | 193 | NSData *postData = [bobyString dataUsingEncoding:NSUTF8StringEncoding]; 194 | [mutableRequest setHTTPMethod:@"POST"]; 195 | [mutableRequest setHTTPBody:postData]; 196 | NSURLSession *session = [NSURLSession sharedSession]; 197 | NSURLSessionTask *task = [session dataTaskWithRequest:mutableRequest completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { 198 | if (error == nil) { 199 | NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil]; 200 | NSLog(@"dict = %@", dict); 201 | } 202 | 203 | }]; 204 | [task resume]; 205 | } 206 | 207 | - (void)testRequest { 208 | 209 | NSMutableURLRequest *postRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/AFNetworking/2.5.4/AFNetworking.podspec.json"]]; 210 | [postRequest setHTTPMethod:@"POST"]; 211 | [postRequest setAllHTTPHeaderFields:@{@"Content-Type":@"2"}]; 212 | NSData *postData = [@"key1=value1&key2=value2" dataUsingEncoding:NSUTF8StringEncoding]; 213 | [postRequest setHTTPBody:postData]; 214 | 215 | 216 | [NSURLConnection sendAsynchronousRequest:postRequest queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { 217 | 218 | }]; 219 | 220 | 221 | [NSURLConnection sendAsynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.baidu.com/"]] queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { 222 | 223 | }]; 224 | 225 | [NSURLConnection sendAsynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[@"https://www.linkedin.com/countserv/count/share?url={google.com}&format=jsonp" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]] queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { 226 | }]; 227 | 228 | //404 229 | [NSURLConnection sendAsynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://api.github.com/xx"]] queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { 230 | 231 | }]; 232 | 233 | } 234 | #pragma clang diagnostic pop 235 | 236 | - (void)didReceiveMemoryWarning { 237 | [super didReceiveMemoryWarning]; 238 | // Dispose of any resources that can be recreated. 239 | } 240 | 241 | @end 242 | -------------------------------------------------------------------------------- /NetworkEye/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 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0.1 23 | LSRequiresIPhoneOS 24 | 25 | NSAppTransportSecurity 26 | 27 | NSAllowsArbitraryLoads 28 | 29 | 30 | UILaunchStoryboardName 31 | LaunchScreen 32 | UIMainStoryboardFile 33 | Main 34 | UIRequiredDeviceCapabilities 35 | 36 | armv7 37 | 38 | UISupportedInterfaceOrientations 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEHTTPEye.h: -------------------------------------------------------------------------------- 1 | // 2 | // NEHTTPEye.h 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/3. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define kSQLitePassword @"networkeye" 12 | #define kSaveRequestMaxCount 300 13 | 14 | @interface NEHTTPEye : NSURLProtocol 15 | /** 16 | * open or close HTTP/HTTPS monitor 17 | * 18 | * @param enabled 19 | */ 20 | + (void)setEnabled:(BOOL)enabled; 21 | 22 | /** 23 | * display HTTP/HTTPS monitor state 24 | * 25 | * @return HTTP/HTTPS monitor state 26 | */ 27 | + (BOOL)isEnabled; 28 | @end 29 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEHTTPEye.m: -------------------------------------------------------------------------------- 1 | // 2 | // NEHTTPEye.m 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/3. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "NEHTTPEye.h" 10 | 11 | #import "NEHTTPModel.h" 12 | #import "NEHTTPModelManager.h" 13 | #import "UIWindow+NEExtension.h" 14 | #import "NEURLSessionConfiguration.h" 15 | #import "NEKeyboardShortcutManager.h" 16 | #import "NEHTTPEyeViewController.h" 17 | @interface NEHTTPEye () 18 | @property (nonatomic, strong) NSURLConnection *connection; 19 | @property (nonatomic, strong) NSURLResponse *response; 20 | @property (nonatomic, strong) NSMutableData *data; 21 | @property (nonatomic, strong) NSDate *startDate; 22 | @property (nonatomic,strong) NEHTTPModel *ne_HTTPModel; 23 | @end 24 | 25 | @implementation NEHTTPEye 26 | @synthesize ne_HTTPModel; 27 | #pragma mark - public 28 | + (void)setEnabled:(BOOL)enabled { 29 | [[NSUserDefaults standardUserDefaults] setDouble:enabled forKey:@"NetworkEyeEnable"]; 30 | [[NSUserDefaults standardUserDefaults] synchronize]; 31 | NEURLSessionConfiguration * sessionConfiguration=[NEURLSessionConfiguration defaultConfiguration]; 32 | 33 | if (enabled) { 34 | [NSURLProtocol registerClass:[NEHTTPEye class]]; 35 | if (![sessionConfiguration isSwizzle]) { 36 | [sessionConfiguration load]; 37 | } 38 | }else{ 39 | [NSURLProtocol unregisterClass:[NEHTTPEye class]]; 40 | if ([sessionConfiguration isSwizzle]) { 41 | [sessionConfiguration unload]; 42 | } 43 | } 44 | #if TARGET_OS_SIMULATOR 45 | [NEKeyboardShortcutManager sharedManager].enabled = enabled; 46 | [[NEKeyboardShortcutManager sharedManager] registerSimulatorShortcutWithKey:@"n" modifiers:UIKeyModifierCommand action:^{ 47 | NEHTTPEyeViewController *viewController = [[NEHTTPEyeViewController alloc] init]; 48 | [[[[[UIApplication sharedApplication] delegate] window] rootViewController] 49 | presentViewController:viewController animated:YES completion:nil]; 50 | } description:nil]; 51 | #endif 52 | } 53 | 54 | + (BOOL)isEnabled { 55 | return [[[NSUserDefaults standardUserDefaults] objectForKey:@"NetworkEyeEnable"] boolValue]; 56 | } 57 | #pragma mark - superclass methods 58 | - (instancetype)init { 59 | self = [super init]; 60 | if (self) { 61 | } 62 | return self; 63 | } 64 | 65 | + (BOOL)canInitWithRequest:(NSURLRequest *)request { 66 | if (![request.URL.scheme isEqualToString:@"http"] && 67 | ![request.URL.scheme isEqualToString:@"https"]) { 68 | return NO; 69 | } 70 | 71 | if ([NSURLProtocol propertyForKey:@"NEHTTPEye" inRequest:request] ) { 72 | return NO; 73 | } 74 | return YES; 75 | } 76 | 77 | + (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request { 78 | 79 | NSMutableURLRequest *mutableReqeust = [request mutableCopy]; 80 | [NSURLProtocol setProperty:@YES 81 | forKey:@"NEHTTPEye" 82 | inRequest:mutableReqeust]; 83 | return [mutableReqeust copy]; 84 | } 85 | 86 | - (void)startLoading { 87 | self.startDate = [NSDate date]; 88 | self.data = [NSMutableData data]; 89 | 90 | #pragma clang diagnostic push 91 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 92 | self.connection = [[NSURLConnection alloc] initWithRequest:[[self class] canonicalRequestForRequest:self.request] delegate:self startImmediately:YES]; 93 | #pragma clang diagnostic pop 94 | 95 | ne_HTTPModel=[[NEHTTPModel alloc] init]; 96 | ne_HTTPModel.ne_request=self.request; 97 | ne_HTTPModel.startDateString=[self stringWithDate:[NSDate date]]; 98 | 99 | NSTimeInterval myID=[[NSDate date] timeIntervalSince1970]; 100 | double randomNum=((double)(arc4random() % 100))/10000; 101 | ne_HTTPModel.myID=myID+randomNum; 102 | } 103 | 104 | - (void)stopLoading { 105 | [self.connection cancel]; 106 | ne_HTTPModel.ne_response=(NSHTTPURLResponse *)self.response; 107 | ne_HTTPModel.endDateString=[self stringWithDate:[NSDate date]]; 108 | NSString *mimeType = self.response.MIMEType; 109 | if ([mimeType isEqualToString:@"application/json"]) { 110 | ne_HTTPModel.receiveJSONData = [self responseJSONFromData:self.data]; 111 | } else if ([mimeType isEqualToString:@"text/javascript"]) { 112 | // try to parse json if it is jsonp request 113 | NSString *jsonString = [[NSString alloc] initWithData:self.data encoding:NSUTF8StringEncoding]; 114 | // formalize string 115 | if ([jsonString hasSuffix:@")"]) { 116 | jsonString = [NSString stringWithFormat:@"%@;", jsonString]; 117 | } 118 | if ([jsonString hasSuffix:@");"]) { 119 | NSRange range = [jsonString rangeOfString:@"("]; 120 | if (range.location != NSNotFound) { 121 | range.location++; 122 | range.length = [jsonString length] - range.location - 2; // removes parens and trailing semicolon 123 | jsonString = [jsonString substringWithRange:range]; 124 | NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; 125 | ne_HTTPModel.receiveJSONData = [self responseJSONFromData:jsonData]; 126 | } 127 | } 128 | 129 | }else if ([mimeType isEqualToString:@"application/xml"] ||[mimeType isEqualToString:@"text/xml"]){ 130 | NSString *xmlString = [[NSString alloc]initWithData:self.data encoding:NSUTF8StringEncoding]; 131 | if (xmlString && xmlString.length>0) { 132 | ne_HTTPModel.receiveJSONData = xmlString;//example http://webservice.webxml.com.cn/webservices/qqOnlineWebService.asmx/qqCheckOnline?qqCode=2121 133 | } 134 | } 135 | double flowCount=[[[NSUserDefaults standardUserDefaults] objectForKey:@"flowCount"] doubleValue]; 136 | if (!flowCount) { 137 | flowCount=0.0; 138 | } 139 | flowCount=flowCount+self.response.expectedContentLength/(1024.0*1024.0); 140 | [[NSUserDefaults standardUserDefaults] setDouble:flowCount forKey:@"flowCount"]; 141 | [[NSUserDefaults standardUserDefaults] synchronize];//https://github.com/coderyi/NetworkEye/pull/6 142 | [[NEHTTPModelManager defaultManager] addModel:ne_HTTPModel]; 143 | } 144 | 145 | #pragma mark - NSURLConnectionDelegate 146 | 147 | - (void)connection:(NSURLConnection *)connection 148 | didFailWithError:(NSError *)error { 149 | [[self client] URLProtocol:self didFailWithError:error]; 150 | } 151 | 152 | - (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection { 153 | return YES; 154 | } 155 | 156 | - (void)connection:(NSURLConnection *)connection 157 | didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { 158 | [[self client] URLProtocol:self didReceiveAuthenticationChallenge:challenge]; 159 | } 160 | 161 | - (void)connection:(NSURLConnection *)connection 162 | didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { 163 | [[self client] URLProtocol:self didCancelAuthenticationChallenge:challenge]; 164 | } 165 | 166 | #pragma mark - NSURLConnectionDataDelegate 167 | - (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response { 168 | if (response != nil){ 169 | self.response = response; 170 | [[self client] URLProtocol:self wasRedirectedToRequest:request redirectResponse:response]; 171 | } 172 | return request; 173 | } 174 | 175 | - (void)connection:(NSURLConnection *)connection 176 | didReceiveResponse:(NSURLResponse *)response { 177 | [[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageAllowed]; 178 | self.response = response; 179 | } 180 | 181 | - (void)connection:(NSURLConnection *)connection 182 | didReceiveData:(NSData *)data { 183 | NSString *mimeType = self.response.MIMEType; 184 | if ([mimeType isEqualToString:@"application/json"]) { 185 | NSArray *allMapRequests = [[NEHTTPModelManager defaultManager] allMapObjects]; 186 | for (NSInteger i=0; i < allMapRequests.count; i++) { 187 | NEHTTPModel *req = [allMapRequests objectAtIndex:i]; 188 | if ([[ne_HTTPModel.ne_request.URL absoluteString] containsString:req.mapPath]) { 189 | NSData *jsonData = [req.mapJSONData dataUsingEncoding:NSUTF8StringEncoding]; 190 | [[self client] URLProtocol:self didLoadData:jsonData]; 191 | [self.data appendData:jsonData]; 192 | return; 193 | 194 | } 195 | } 196 | } 197 | [[self client] URLProtocol:self didLoadData:data]; 198 | [self.data appendData:data]; 199 | } 200 | 201 | - (NSCachedURLResponse *)connection:(NSURLConnection *)connection 202 | willCacheResponse:(NSCachedURLResponse *)cachedResponse { 203 | return cachedResponse; 204 | } 205 | 206 | - (void)connectionDidFinishLoading:(NSURLConnection *)connection { 207 | [[self client] URLProtocolDidFinishLoading:self]; 208 | } 209 | 210 | #pragma mark - Utils 211 | 212 | -(id)responseJSONFromData:(NSData *)data { 213 | if(data == nil) return nil; 214 | NSError *error = nil; 215 | id returnValue = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error]; 216 | if(error) { 217 | NSLog(@"JSON Parsing Error: %@", error); 218 | //https://github.com/coderyi/NetworkEye/issues/3 219 | return nil; 220 | } 221 | //https://github.com/coderyi/NetworkEye/issues/1 222 | if (!returnValue || returnValue == [NSNull null]) { 223 | return nil; 224 | } 225 | 226 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:returnValue options:NSJSONWritingPrettyPrinted error:nil]; 227 | NSString *jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding]; 228 | return jsonString; 229 | } 230 | 231 | - (NSString *)stringWithDate:(NSDate *)date { 232 | NSString *destDateString = [[NEHTTPEye defaultDateFormatter] stringFromDate:date]; 233 | return destDateString; 234 | } 235 | 236 | + (NSDateFormatter *)defaultDateFormatter { 237 | static NSDateFormatter *staticDateFormatter; 238 | static dispatch_once_t onceToken; 239 | dispatch_once(&onceToken, ^{ 240 | staticDateFormatter=[[NSDateFormatter alloc] init]; 241 | [staticDateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss zzz"];//zzz表示时区,zzz可以删除,这样返回的日期字符将不包含时区信息。 242 | }); 243 | return staticDateFormatter; 244 | } 245 | 246 | @end 247 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEHTTPEyeDetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NEHTTPEyeDetailViewController.h 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/4. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class NEHTTPModel; 12 | 13 | @interface NEHTTPEyeDetailViewController : UIViewController 14 | /** 15 | * detail page's data model,about request,response and data 16 | */ 17 | @property (nonatomic,strong) NEHTTPModel *model; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEHTTPEyeDetailViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NEHTTPEyeDetailViewController.m 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/4. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "NEHTTPEyeDetailViewController.h" 10 | #import "NEMapViewController.h" 11 | #import "NEHTTPModel.h" 12 | @interface NEHTTPEyeDetailViewController (){ 13 | 14 | UITextView *mainTextView; 15 | 16 | } 17 | 18 | @end 19 | 20 | @implementation NEHTTPEyeDetailViewController 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | // Do any additional setup after loading the view. 25 | 26 | BOOL isiPhoneX = (([[UIScreen mainScreen] bounds].size.width == 375.f && [[UIScreen mainScreen] bounds].size.height == 812.f) || ([[UIScreen mainScreen] bounds].size.height == 375.f && [[UIScreen mainScreen] bounds].size.width == 812.f)); 27 | 28 | if ([[[UIDevice currentDevice]systemVersion] floatValue] >= 7.0) { 29 | self.edgesForExtendedLayout = UIRectEdgeBottom | UIRectEdgeLeft | UIRectEdgeRight; 30 | 31 | } 32 | self.automaticallyAdjustsScrollViewInsets=NO; 33 | self.view.backgroundColor=[UIColor whiteColor]; 34 | 35 | UIView *bar=[[UIView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 64+(isiPhoneX?24:0))]; 36 | [self.view addSubview:bar]; 37 | bar.backgroundColor=[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f]; 38 | 39 | UIButton *backBt=[UIButton buttonWithType:UIButtonTypeCustom]; 40 | backBt.frame=CGRectMake(10, 27+(isiPhoneX?24:0), 40, 30); 41 | [backBt setTitle:@"back" forState:UIControlStateNormal]; 42 | backBt.titleLabel.font=[UIFont systemFontOfSize:15]; 43 | [backBt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 44 | [backBt addTarget:self action:@selector(backBtAction) forControlEvents:UIControlEventTouchUpInside]; 45 | [bar addSubview:backBt]; 46 | 47 | UIButton *mapBt=[UIButton buttonWithType:UIButtonTypeCustom]; 48 | mapBt.frame=CGRectMake([[UIScreen mainScreen] bounds].size.width-60, 27+(isiPhoneX?24:0), 50, 30); 49 | [mapBt setTitle:@"map" forState:UIControlStateNormal]; 50 | mapBt.titleLabel.font=[UIFont systemFontOfSize:13]; 51 | [mapBt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 52 | [mapBt addTarget:self action:@selector(rightAction) forControlEvents:UIControlEventTouchUpInside]; 53 | [bar addSubview:mapBt]; 54 | 55 | UILabel *titleText = [[UILabel alloc] initWithFrame: CGRectMake(([[UIScreen mainScreen] bounds].size.width-230)/2, 20+(isiPhoneX?24:0), 230, 44)]; 56 | titleText.backgroundColor = [UIColor clearColor]; 57 | titleText.textColor=[UIColor whiteColor]; 58 | [titleText setFont:[UIFont systemFontOfSize:13.0]]; 59 | titleText.textAlignment=NSTextAlignmentCenter; 60 | [bar addSubview:titleText]; 61 | titleText.text=_model.requestURLString; 62 | 63 | mainTextView=[[UITextView alloc] initWithFrame:CGRectMake(0, 64+(isiPhoneX?24:0), [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height-64-(isiPhoneX?24:0))]; 64 | [self.view addSubview:mainTextView]; 65 | mainTextView.editable=NO; 66 | 67 | [self setupAttributedString]; 68 | } 69 | 70 | 71 | - (void)setupAttributedString{ 72 | 73 | NSAttributedString *startDateString; 74 | NSAttributedString *endDateString; 75 | NSAttributedString *requestURLString; 76 | NSAttributedString *requestCachePolicyString; 77 | NSAttributedString *requestTimeoutInterval; 78 | NSAttributedString *requestHTTPMethod; 79 | NSAttributedString *requestAllHTTPHeaderFields; 80 | NSAttributedString *requestHTTPBody; 81 | NSAttributedString *responseMIMEType; 82 | NSAttributedString *responseExpectedContentLength; 83 | NSAttributedString *responseTextEncodingName; 84 | NSAttributedString *responseSuggestedFilename; 85 | NSAttributedString *responseStatusCode; 86 | NSAttributedString *responseAllHeaderFields; 87 | NSAttributedString *receiveJSONData; 88 | 89 | NSAttributedString *startDateStringDetail; 90 | NSAttributedString *endDateStringDetail; 91 | NSAttributedString *requestURLStringDetail; 92 | NSAttributedString *requestCachePolicyStringDetail; 93 | NSAttributedString *requestTimeoutIntervalDetail; 94 | NSAttributedString *requestHTTPMethodDetail; 95 | NSAttributedString *requestAllHTTPHeaderFieldsDetail; 96 | NSAttributedString *requestHTTPBodyDetail; 97 | NSAttributedString *responseMIMETypeDetail; 98 | NSAttributedString *responseExpectedContentLengthDetail; 99 | NSAttributedString *responseTextEncodingNameDetail; 100 | NSAttributedString *responseSuggestedFilenameDetail; 101 | NSAttributedString *responseStatusCodeDetail; 102 | NSAttributedString *responseAllHeaderFieldsDetail; 103 | NSAttributedString *receiveJSONDataDetail; 104 | 105 | UIColor *titleColor=[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f]; 106 | UIFont *titleFont=[UIFont systemFontOfSize:14.0]; 107 | UIColor *detailColor=[UIColor blackColor]; 108 | UIFont *detailFont=[UIFont systemFontOfSize:14.0]; 109 | 110 | startDateString = [[NSMutableAttributedString alloc] initWithString:@"[startDate]:" 111 | attributes:@{ 112 | NSFontAttributeName : titleFont, 113 | NSForegroundColorAttributeName: titleColor 114 | }]; 115 | 116 | endDateString = [[NSMutableAttributedString alloc] initWithString:@"[endDate]:" 117 | attributes:@{ 118 | NSFontAttributeName : titleFont, 119 | NSForegroundColorAttributeName: titleColor 120 | }]; 121 | 122 | requestURLString = [[NSMutableAttributedString alloc] initWithString:@"[requestURL]\n" 123 | attributes:@{ 124 | NSFontAttributeName : titleFont, 125 | NSForegroundColorAttributeName: titleColor 126 | }]; 127 | 128 | requestCachePolicyString = [[NSMutableAttributedString alloc] initWithString:@"[requestCachePolicy]\n" 129 | attributes:@{ 130 | NSFontAttributeName : titleFont, 131 | NSForegroundColorAttributeName: titleColor 132 | }]; 133 | 134 | requestTimeoutInterval = [[NSMutableAttributedString alloc] initWithString:@"[requestTimeoutInterval]:" 135 | attributes:@{ 136 | NSFontAttributeName : titleFont, 137 | NSForegroundColorAttributeName: titleColor 138 | }]; 139 | 140 | 141 | requestHTTPMethod = [[NSMutableAttributedString alloc] initWithString:@"[requestHTTPMethod]:" 142 | attributes:@{ 143 | NSFontAttributeName : titleFont, 144 | NSForegroundColorAttributeName: titleColor 145 | }]; 146 | 147 | 148 | requestAllHTTPHeaderFields = [[NSMutableAttributedString alloc] initWithString:@"[requestAllHTTPHeaderFields]\n" 149 | attributes:@{ 150 | NSFontAttributeName : titleFont, 151 | NSForegroundColorAttributeName: titleColor 152 | }]; 153 | 154 | 155 | requestHTTPBody = [[NSMutableAttributedString alloc] initWithString:@"[requestHTTPBody]\n" 156 | attributes:@{ 157 | NSFontAttributeName : titleFont, 158 | NSForegroundColorAttributeName: titleColor 159 | }]; 160 | 161 | 162 | responseMIMEType = [[NSMutableAttributedString alloc] initWithString:@"[responseMIMEType]:" 163 | attributes:@{ 164 | NSFontAttributeName : titleFont, 165 | NSForegroundColorAttributeName: titleColor 166 | }]; 167 | 168 | 169 | responseExpectedContentLength = [[NSMutableAttributedString alloc] initWithString:@"[responseExpectedContentLength]:" 170 | attributes:@{ 171 | NSFontAttributeName : titleFont, 172 | NSForegroundColorAttributeName: titleColor 173 | }]; 174 | 175 | 176 | responseTextEncodingName = [[NSMutableAttributedString alloc] initWithString:@"[responseTextEncodingName]:" 177 | attributes:@{ 178 | NSFontAttributeName : titleFont, 179 | NSForegroundColorAttributeName: titleColor 180 | }]; 181 | 182 | 183 | responseSuggestedFilename = [[NSMutableAttributedString alloc] initWithString:@"[responseSuggestedFilename]:" 184 | attributes:@{ 185 | NSFontAttributeName : titleFont, 186 | NSForegroundColorAttributeName: titleColor 187 | }]; 188 | 189 | 190 | responseStatusCode = [[NSMutableAttributedString alloc] initWithString:@"[responseStatusCode]:" 191 | attributes:@{ 192 | NSFontAttributeName : titleFont, 193 | NSForegroundColorAttributeName: titleColor 194 | }]; 195 | 196 | 197 | responseAllHeaderFields = [[NSMutableAttributedString alloc] initWithString:@"[responseAllHeaderFields]\n" 198 | attributes:@{ 199 | NSFontAttributeName : titleFont, 200 | NSForegroundColorAttributeName: titleColor 201 | }]; 202 | 203 | if ([_model.responseMIMEType isEqualToString:@"application/xml"] ||[_model.responseMIMEType isEqualToString:@"text/xml"]) { 204 | receiveJSONData = [[NSMutableAttributedString alloc] initWithString:@"[responseXML]\n" 205 | attributes:@{ 206 | NSFontAttributeName : titleFont, 207 | NSForegroundColorAttributeName: titleColor 208 | }]; 209 | }else { 210 | receiveJSONData = [[NSMutableAttributedString alloc] initWithString:@"[responseJSON]\n" 211 | attributes:@{ 212 | NSFontAttributeName : titleFont, 213 | NSForegroundColorAttributeName: titleColor 214 | }]; 215 | } 216 | 217 | 218 | 219 | 220 | //detail 221 | 222 | startDateStringDetail = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n",_model.startDateString] 223 | attributes:@{ 224 | NSFontAttributeName : detailFont, 225 | NSForegroundColorAttributeName: detailColor 226 | }]; 227 | 228 | 229 | endDateStringDetail = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n\n",_model.endDateString] 230 | attributes:@{ 231 | NSFontAttributeName : detailFont, 232 | NSForegroundColorAttributeName: detailColor 233 | }]; 234 | 235 | requestURLStringDetail = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n",_model.requestURLString] 236 | attributes:@{ 237 | NSFontAttributeName : detailFont, 238 | NSForegroundColorAttributeName: detailColor 239 | }]; 240 | 241 | 242 | requestCachePolicyStringDetail = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n",_model.requestCachePolicy] 243 | attributes:@{ 244 | NSFontAttributeName : detailFont, 245 | NSForegroundColorAttributeName: detailColor 246 | }]; 247 | 248 | 249 | requestTimeoutIntervalDetail = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%lf\n",_model.requestTimeoutInterval] 250 | attributes:@{ 251 | NSFontAttributeName : detailFont, 252 | NSForegroundColorAttributeName: detailColor 253 | }]; 254 | 255 | 256 | requestHTTPMethodDetail = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n",_model.requestHTTPMethod] 257 | attributes:@{ 258 | NSFontAttributeName : detailFont, 259 | NSForegroundColorAttributeName: detailColor 260 | }]; 261 | 262 | requestAllHTTPHeaderFieldsDetail = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n",_model.requestAllHTTPHeaderFields] 263 | attributes:@{ 264 | NSFontAttributeName : detailFont, 265 | NSForegroundColorAttributeName: detailColor 266 | }]; 267 | 268 | requestHTTPBodyDetail = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n\n",_model.requestHTTPBody] 269 | attributes:@{ 270 | NSFontAttributeName : detailFont, 271 | NSForegroundColorAttributeName: detailColor 272 | }]; 273 | responseMIMETypeDetail = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n",_model.responseMIMEType] 274 | attributes:@{ 275 | NSFontAttributeName : detailFont, 276 | NSForegroundColorAttributeName: detailColor 277 | }]; 278 | responseExpectedContentLengthDetail = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%.2lfKB\n",[_model.responseExpectedContentLength doubleValue]/1024.0] 279 | attributes:@{ 280 | NSFontAttributeName : detailFont, 281 | NSForegroundColorAttributeName: detailColor 282 | }]; 283 | responseTextEncodingNameDetail = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n",_model.responseTextEncodingName] 284 | attributes:@{ 285 | NSFontAttributeName : detailFont, 286 | NSForegroundColorAttributeName: detailColor 287 | }]; 288 | responseSuggestedFilenameDetail = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n",_model.responseSuggestedFilename] 289 | attributes:@{ 290 | NSFontAttributeName : detailFont, 291 | NSForegroundColorAttributeName: detailColor 292 | }]; 293 | 294 | 295 | 296 | UIColor *statusDetailColor=[UIColor colorWithRed:0.96 green:0.15 blue:0.11 alpha:1]; 297 | if (_model.responseStatusCode == 200) { 298 | statusDetailColor=[UIColor colorWithRed:0.11 green:0.76 blue:0.13 alpha:1]; 299 | } 300 | responseStatusCodeDetail = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%d\n",_model.responseStatusCode] 301 | attributes:@{ 302 | NSFontAttributeName : detailFont, 303 | NSForegroundColorAttributeName: statusDetailColor 304 | }]; 305 | 306 | responseAllHeaderFieldsDetail = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n\n",_model.responseAllHeaderFields] 307 | attributes:@{ 308 | NSFontAttributeName : detailFont, 309 | NSForegroundColorAttributeName: detailColor 310 | }]; 311 | 312 | 313 | NSString *transString = [[self class] replaceUnicode:_model.receiveJSONData]; 314 | receiveJSONDataDetail = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n\n",transString] 315 | attributes:@{ 316 | NSFontAttributeName : detailFont, 317 | NSForegroundColorAttributeName: detailColor 318 | }]; 319 | 320 | 321 | NSMutableAttributedString *attrText = [[NSMutableAttributedString alloc] init]; 322 | 323 | [attrText appendAttributedString:startDateString]; 324 | [attrText appendAttributedString:startDateStringDetail]; 325 | 326 | [attrText appendAttributedString:endDateString]; 327 | [attrText appendAttributedString:endDateStringDetail]; 328 | 329 | [attrText appendAttributedString:requestURLString]; 330 | [attrText appendAttributedString:requestURLStringDetail]; 331 | 332 | [attrText appendAttributedString:requestCachePolicyString]; 333 | [attrText appendAttributedString:requestCachePolicyStringDetail]; 334 | 335 | [attrText appendAttributedString:requestTimeoutInterval]; 336 | [attrText appendAttributedString:requestTimeoutIntervalDetail]; 337 | 338 | [attrText appendAttributedString:requestHTTPMethod]; 339 | [attrText appendAttributedString:requestHTTPMethodDetail]; 340 | 341 | [attrText appendAttributedString:requestAllHTTPHeaderFields]; 342 | [attrText appendAttributedString:requestAllHTTPHeaderFieldsDetail]; 343 | 344 | [attrText appendAttributedString:requestHTTPBody]; 345 | [attrText appendAttributedString:requestHTTPBodyDetail]; 346 | 347 | [attrText appendAttributedString:responseMIMEType]; 348 | [attrText appendAttributedString:responseMIMETypeDetail]; 349 | 350 | [attrText appendAttributedString:responseExpectedContentLength]; 351 | [attrText appendAttributedString:responseExpectedContentLengthDetail]; 352 | 353 | [attrText appendAttributedString:responseTextEncodingName]; 354 | [attrText appendAttributedString:responseTextEncodingNameDetail]; 355 | 356 | [attrText appendAttributedString:responseSuggestedFilename]; 357 | [attrText appendAttributedString:responseSuggestedFilenameDetail]; 358 | 359 | [attrText appendAttributedString:responseStatusCode]; 360 | [attrText appendAttributedString:responseStatusCodeDetail]; 361 | 362 | [attrText appendAttributedString:responseAllHeaderFields]; 363 | [attrText appendAttributedString:responseAllHeaderFieldsDetail]; 364 | 365 | [attrText appendAttributedString:receiveJSONData]; 366 | [attrText appendAttributedString:receiveJSONDataDetail]; 367 | 368 | mainTextView.attributedText=attrText; 369 | 370 | } 371 | - (void)backBtAction { 372 | [self dismissViewControllerAnimated:YES completion:nil]; 373 | 374 | } 375 | 376 | - (void)rightAction { 377 | NEMapViewController *map = [[NEMapViewController alloc] init]; 378 | map.model = _model; 379 | [self presentViewController:map animated:YES completion:nil]; 380 | } 381 | 382 | #pragma mark - Utils 383 | 384 | //unicode to utf-8 385 | + (NSString*) replaceUnicode:(NSString*)aUnicodeString { 386 | 387 | NSString *tempStr1 = [aUnicodeString stringByReplacingOccurrencesOfString:@"\\u"withString:@"\\U"]; 388 | NSString *tempStr2 = [tempStr1 stringByReplacingOccurrencesOfString:@"\""withString:@"\\\""]; 389 | NSString *tempStr3 = [[@"\""stringByAppendingString:tempStr2] stringByAppendingString:@"\""]; 390 | NSData *tempData = [tempStr3 dataUsingEncoding:NSUTF8StringEncoding]; 391 | 392 | #pragma clang diagnostic push 393 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 394 | NSString* returnStr = [NSPropertyListSerialization propertyListFromData:tempData 395 | 396 | mutabilityOption:NSPropertyListImmutable 397 | 398 | format:NULL 399 | 400 | errorDescription:NULL]; 401 | #pragma clang diagnostic pop 402 | 403 | return [returnStr stringByReplacingOccurrencesOfString:@"\\r\\n"withString:@"\n"]; 404 | 405 | } 406 | 407 | @end 408 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEHTTPEyeSettingsViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NEHTTPEyeSettingsViewController.h 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/12. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NEHTTPEyeSettingsViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEHTTPEyeSettingsViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NEHTTPEyeSettingsViewController.m 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/12. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "NEHTTPEyeSettingsViewController.h" 10 | #import "NEHTTPEye.h" 11 | #import "NEHTTPModelManager.h" 12 | @interface NEHTTPEyeSettingsViewController (){ 13 | 14 | UITableView *mainTableView; 15 | } 16 | 17 | @end 18 | 19 | @implementation NEHTTPEyeSettingsViewController 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | // Do any additional setup after loading the view. 24 | 25 | BOOL isiPhoneX = (([[UIScreen mainScreen] bounds].size.width == 375.f && [[UIScreen mainScreen] bounds].size.height == 812.f) || ([[UIScreen mainScreen] bounds].size.height == 375.f && [[UIScreen mainScreen] bounds].size.width == 812.f)); 26 | 27 | if ([[[UIDevice currentDevice]systemVersion] floatValue] >= 7.0) { 28 | self.edgesForExtendedLayout = UIRectEdgeBottom | UIRectEdgeLeft | UIRectEdgeRight; 29 | 30 | } 31 | self.automaticallyAdjustsScrollViewInsets=NO; 32 | self.view.backgroundColor=[UIColor whiteColor]; 33 | 34 | UIView *bar=[[UIView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 64+(isiPhoneX?24:0))]; 35 | [self.view addSubview:bar]; 36 | bar.backgroundColor=[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f]; 37 | 38 | UIButton *backBt=[UIButton buttonWithType:UIButtonTypeCustom]; 39 | backBt.frame=CGRectMake(10, 27+(isiPhoneX?24:0), 40, 30); 40 | [backBt setTitle:@"back" forState:UIControlStateNormal]; 41 | backBt.titleLabel.font=[UIFont systemFontOfSize:15]; 42 | [backBt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 43 | [backBt addTarget:self action:@selector(backBtAction) forControlEvents:UIControlEventTouchUpInside]; 44 | [bar addSubview:backBt]; 45 | 46 | UILabel *titleText = [[UILabel alloc] initWithFrame: CGRectMake(([[UIScreen mainScreen] bounds].size.width-230)/2, 20+(isiPhoneX?24:0), 230, 44)]; 47 | titleText.backgroundColor = [UIColor clearColor]; 48 | titleText.textColor=[UIColor whiteColor]; 49 | [titleText setFont:[UIFont systemFontOfSize:15.0]]; 50 | titleText.textAlignment=NSTextAlignmentCenter; 51 | [bar addSubview:titleText]; 52 | titleText.text=@"settings"; 53 | 54 | mainTableView=[[UITableView alloc] initWithFrame:CGRectMake(0, 64+(isiPhoneX?24:0), [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height-64-(isiPhoneX?24:0)) style:UITableViewStyleGrouped]; 55 | [self.view addSubview:mainTableView]; 56 | mainTableView.dataSource=self; 57 | mainTableView.delegate=self; 58 | } 59 | - (void)backBtAction { 60 | [self dismissViewControllerAnimated:YES completion:nil]; 61 | 62 | } 63 | 64 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 65 | 66 | return 3; 67 | 68 | } 69 | 70 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 71 | 72 | UITableViewCell *cell; 73 | 74 | NSString *cellId=@"CellId"; 75 | cell=[tableView dequeueReusableCellWithIdentifier:cellId]; 76 | if (cell==nil) { 77 | cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellId]; 78 | if (indexPath.row==0) { 79 | UISwitch *switch1=[[UISwitch alloc] initWithFrame:CGRectMake([[UIScreen mainScreen] bounds].size.width-70, 7, 60, 40)]; 80 | [cell.contentView addSubview:switch1]; 81 | BOOL NetworkEyeEnable=[[[NSUserDefaults standardUserDefaults] objectForKey:@"NetworkEyeEnable"] boolValue]; 82 | switch1.on=NetworkEyeEnable; 83 | [switch1 addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventValueChanged]; 84 | } 85 | } 86 | cell.textLabel.font=[UIFont systemFontOfSize:12]; 87 | 88 | if (indexPath.row==0) { 89 | cell.textLabel.textColor=[UIColor blackColor]; 90 | cell.textLabel.text=@"NetworkEye Enable"; 91 | }else if (indexPath.row==1){ 92 | cell.textLabel.textColor=[UIColor colorWithRed:0.88 green:0.22 blue:0.22 alpha:1]; 93 | cell.textLabel.text=@"Clear All Maped Requests"; 94 | }else{ 95 | cell.textLabel.textColor=[UIColor colorWithRed:0.88 green:0.22 blue:0.22 alpha:1]; 96 | cell.textLabel.text=@"Clear Recorded Requests"; 97 | } 98 | 99 | 100 | return cell; 101 | 102 | } 103 | 104 | - (void)switchAction:(UISwitch *)tempSwitch { 105 | [[NSUserDefaults standardUserDefaults] setDouble:tempSwitch.on forKey:@"NetworkEyeEnable"]; 106 | [[NSUserDefaults standardUserDefaults] synchronize]; 107 | [NEHTTPEye setEnabled:tempSwitch.on]; 108 | } 109 | 110 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 111 | if (indexPath.row==1) { 112 | UIAlertView *alertView=[[UIAlertView alloc] initWithTitle:@"message" message:@"Are you sure to delete it" delegate:self cancelButtonTitle:@"yes" otherButtonTitles:@"no", nil]; 113 | alertView.tag=101; 114 | [alertView show]; 115 | } 116 | if (indexPath.row==2) { 117 | UIAlertView *alertView=[[UIAlertView alloc] initWithTitle:@"message" message:@"Are you sure to delete it" delegate:self cancelButtonTitle:@"yes" otherButtonTitles:@"no", nil]; 118 | alertView.tag=102; 119 | [alertView show]; 120 | } 121 | 122 | 123 | } 124 | 125 | 126 | - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex NS_DEPRECATED_IOS(2_0, 9_0){ 127 | if(alertView.tag ==101){ 128 | if(buttonIndex==0){ 129 | [[NEHTTPModelManager defaultManager] removeAllMapObjects]; 130 | } 131 | return; 132 | } 133 | if(buttonIndex==0){ 134 | [[NEHTTPModelManager defaultManager] deleteAllItem]; 135 | } 136 | } 137 | 138 | - (void)didReceiveMemoryWarning { 139 | [super didReceiveMemoryWarning]; 140 | // Dispose of any resources that can be recreated. 141 | } 142 | 143 | @end 144 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEHTTPEyeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NEHTTPEyeViewController.h 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/4. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NEHTTPEyeViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEHTTPEyeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NEHTTPEyeViewController.m 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/4. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "NEHTTPEyeViewController.h" 10 | 11 | #import "NEHTTPModel.h" 12 | #import "NEHTTPModelManager.h" 13 | #import "NEHTTPEyeDetailViewController.h" 14 | #import "NEHTTPEyeSettingsViewController.h" 15 | #include 16 | #include 17 | 18 | @interface NEHTTPEyeViewController () { 19 | UITableView *mainTableView; 20 | NSArray *httpRequests; 21 | UISearchBar *mySearchBar; 22 | UISearchDisplayController *mySearchDisplayController; 23 | UISearchController *mySearchController; 24 | NSArray *filterHTTPRequests; 25 | BOOL isiPhoneX; 26 | BOOL isiPhone11; 27 | } 28 | 29 | @end 30 | 31 | @implementation NEHTTPEyeViewController 32 | 33 | - (void)viewDidLoad { 34 | [super viewDidLoad]; 35 | // Do any additional setup after loading the view. 36 | 37 | isiPhoneX = (([[UIScreen mainScreen] bounds].size.width == 375.f && [[UIScreen mainScreen] bounds].size.height == 812.f) || ([[UIScreen mainScreen] bounds].size.height == 375.f && [[UIScreen mainScreen] bounds].size.width == 812.f)); 38 | 39 | self.automaticallyAdjustsScrollViewInsets=NO; 40 | self.view.backgroundColor=[UIColor whiteColor]; 41 | 42 | mainTableView=[[UITableView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height-64-(isiPhoneX?24:0)) style:UITableViewStylePlain]; 43 | [self.view addSubview:mainTableView]; 44 | 45 | double flowCount=[[[NSUserDefaults standardUserDefaults] objectForKey:@"flowCount"] doubleValue]; 46 | if (!flowCount) { 47 | flowCount=0.0; 48 | } 49 | UIColor *titleColor=[UIColor whiteColor]; 50 | UIFont *titleFont=[UIFont systemFontOfSize:18.0]; 51 | UIColor *detailColor=[UIColor whiteColor]; 52 | UIFont *detailFont=[UIFont systemFontOfSize:12.0]; 53 | 54 | NSMutableAttributedString *titleString = [[NSMutableAttributedString alloc] initWithString:@"NetworkEye\n" 55 | attributes:@{ 56 | NSFontAttributeName : titleFont, 57 | NSForegroundColorAttributeName: titleColor 58 | }]; 59 | 60 | NSMutableAttributedString *flowCountString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"流量共%.1lfMB",flowCount] 61 | attributes:@{ 62 | NSFontAttributeName : detailFont, 63 | NSForegroundColorAttributeName: detailColor 64 | }]; 65 | 66 | NSMutableAttributedString *attrText = [[NSMutableAttributedString alloc] init]; 67 | [attrText appendAttributedString:titleString]; 68 | [attrText appendAttributedString:flowCountString]; 69 | UILabel *titleText = [[UILabel alloc] initWithFrame: CGRectMake(([[UIScreen mainScreen] bounds].size.width-120)/2, 20+(isiPhoneX?24:0), 120, 44)]; 70 | titleText.backgroundColor = [UIColor clearColor]; 71 | titleText.textColor=[UIColor whiteColor]; 72 | titleText.textAlignment=NSTextAlignmentCenter; 73 | titleText.numberOfLines=0; 74 | titleText.attributedText=attrText; 75 | 76 | if ([self.navigationController viewControllers].count<1) { 77 | UIView *bar=[[UIView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 64+(isiPhoneX?24:0))]; 78 | [self.view addSubview:bar]; 79 | bar.backgroundColor=[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f]; 80 | 81 | 82 | UIButton *backBt=[UIButton buttonWithType:UIButtonTypeCustom]; 83 | backBt.frame=CGRectMake(10, 27+(isiPhoneX?24:0), 40, 30); 84 | [backBt setTitle:@"back" forState:UIControlStateNormal]; 85 | backBt.titleLabel.font=[UIFont systemFontOfSize:15]; 86 | [backBt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 87 | [backBt addTarget:self action:@selector(backBtAction) forControlEvents:UIControlEventTouchUpInside]; 88 | [bar addSubview:backBt]; 89 | 90 | UIButton *settingsBt=[UIButton buttonWithType:UIButtonTypeCustom]; 91 | settingsBt.frame=CGRectMake([[UIScreen mainScreen] bounds].size.width-60, 27+(isiPhoneX?24:0), 50, 30); 92 | [settingsBt setTitle:@"settings" forState:UIControlStateNormal]; 93 | settingsBt.titleLabel.font=[UIFont systemFontOfSize:13]; 94 | [settingsBt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 95 | [settingsBt addTarget:self action:@selector(rightAction) forControlEvents:UIControlEventTouchUpInside]; 96 | [bar addSubview:settingsBt]; 97 | mainTableView.frame=CGRectMake(0, 64+(isiPhoneX?24:0), [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height-64-(isiPhoneX?24:0)); 98 | [bar addSubview:titleText]; 99 | }else{ 100 | titleText.frame=CGRectMake(([[UIScreen mainScreen] bounds].size.width-120)/2, 0, 120, 44); 101 | [self.navigationController.navigationBar addSubview:titleText]; 102 | UIBarButtonItem *right=[[UIBarButtonItem alloc] initWithTitle:@"settings" style:UIBarButtonItemStylePlain target:self action:@selector(rightAction)]; 103 | self.navigationItem.rightBarButtonItem=right; 104 | } 105 | 106 | [self setupSearch]; 107 | mainTableView.dataSource=self; 108 | mainTableView.delegate=self; 109 | httpRequests=[[[[NEHTTPModelManager defaultManager] allobjects] reverseObjectEnumerator] allObjects]; 110 | 111 | isiPhone11 = [[self hardwareString] containsString:@"iPhone12"]; 112 | if (@available(iOS 13.0, *)) { 113 | if ([[self hardwareString] containsString:@"x86_64"]) { 114 | isiPhone11 = YES; 115 | } 116 | } 117 | } 118 | 119 | - (void)viewWillAppear:(BOOL)animated { 120 | [super viewWillAppear:animated]; 121 | httpRequests=[[[[NEHTTPModelManager defaultManager] allobjects] reverseObjectEnumerator] allObjects]; 122 | [mainTableView reloadData]; 123 | } 124 | 125 | - (void)rightAction { 126 | NEHTTPEyeSettingsViewController *settings = [[NEHTTPEyeSettingsViewController alloc] init]; 127 | [self presentViewController:settings animated:YES completion:nil]; 128 | } 129 | 130 | - (void)setupSearch { 131 | 132 | filterHTTPRequests=[[NSArray alloc] init]; 133 | 134 | if (@available(iOS 13.0, *)) { 135 | mySearchController = [[UISearchController alloc] initWithSearchResultsController:nil]; 136 | mySearchController.searchResultsUpdater = self; 137 | mySearchController.searchBar.delegate = self; 138 | [mySearchController.searchBar setAutocapitalizationType:UITextAutocapitalizationTypeNone]; 139 | [mySearchController.searchBar sizeToFit]; 140 | mainTableView.tableHeaderView = mySearchController.searchBar; 141 | } else { 142 | mySearchBar = [[UISearchBar alloc] init]; 143 | mySearchBar.delegate = self; 144 | [mySearchBar setAutocapitalizationType:UITextAutocapitalizationTypeNone]; 145 | [mySearchBar sizeToFit]; 146 | mainTableView.tableHeaderView = mySearchBar; 147 | mySearchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:mySearchBar contentsController:self]; 148 | [mySearchDisplayController setDelegate:self]; 149 | [mySearchDisplayController setSearchResultsDataSource:self]; 150 | [mySearchDisplayController setSearchResultsDelegate:self]; 151 | } 152 | } 153 | 154 | - (void)backBtAction { 155 | 156 | [self dismissViewControllerAnimated:YES completion:nil]; 157 | 158 | } 159 | 160 | #pragma mark - UITableViewDataSource &UITableViewDelegate 161 | 162 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 163 | if (tableView == mySearchDisplayController.searchResultsTableView || (mySearchController.isActive && mySearchController.searchBar.text.length > 0)) { 164 | return filterHTTPRequests.count; 165 | } 166 | return httpRequests.count; 167 | 168 | } 169 | 170 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 171 | 172 | UITableViewCell *cell; 173 | 174 | NSString *cellId=@"CellId"; 175 | cell=[tableView dequeueReusableCellWithIdentifier:cellId]; 176 | if (cell==nil) { 177 | cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellId]; 178 | } 179 | cell.textLabel.font=[UIFont systemFontOfSize:12]; 180 | cell.textLabel.textColor=[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f]; 181 | NEHTTPModel *currenModel=[self modelForTableView:tableView atIndexPath:indexPath]; 182 | 183 | cell.textLabel.text=currenModel.requestURLString; 184 | 185 | NSAttributedString *responseStatusCode; 186 | NSAttributedString *requestHTTPMethod; 187 | UIColor *titleColor=[UIColor colorWithRed:0.96 green:0.15 blue:0.11 alpha:1]; 188 | if (currenModel.responseStatusCode == 200) { 189 | titleColor=[UIColor colorWithRed:0.11 green:0.76 blue:0.13 alpha:1]; 190 | } 191 | UIFont *titleFont=[UIFont systemFontOfSize:12.0]; 192 | UIColor *detailColor=[UIColor blackColor]; 193 | UIFont *detailFont=[UIFont systemFontOfSize:12.0]; 194 | responseStatusCode = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%d ",currenModel.responseStatusCode] 195 | attributes:@{ 196 | NSFontAttributeName : titleFont, 197 | NSForegroundColorAttributeName: titleColor 198 | }]; 199 | 200 | requestHTTPMethod = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ %@ %@",currenModel.requestHTTPMethod,currenModel.responseMIMEType,[((NEHTTPModel *)((httpRequests)[indexPath.row])).startDateString substringFromIndex:5]] 201 | attributes:@{ 202 | NSFontAttributeName : detailFont, 203 | NSForegroundColorAttributeName: detailColor 204 | }]; 205 | NSMutableAttributedString *detail=[[NSMutableAttributedString alloc] init]; 206 | [detail appendAttributedString:responseStatusCode]; 207 | [detail appendAttributedString:requestHTTPMethod]; 208 | cell.detailTextLabel.attributedText=detail; 209 | 210 | return cell; 211 | 212 | } 213 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 214 | NEHTTPEyeDetailViewController *detail = [[NEHTTPEyeDetailViewController alloc] init]; 215 | detail.model = [self modelForTableView:tableView atIndexPath:indexPath]; 216 | [self presentViewController:detail animated:YES completion:nil]; 217 | } 218 | 219 | #pragma mark - UISearchBarDelegate 220 | - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar { 221 | if (isiPhone11) { // iPhone11上修改tableView的frame有bug 222 | return YES; 223 | } 224 | if ([self.navigationController viewControllers].count>0) { 225 | return YES; 226 | } 227 | //准备搜寻前,把上面调整的TableView调整回全屏幕的状态 228 | [UIView animateWithDuration:0.2 animations:^{ 229 | mainTableView.frame = CGRectMake(0, 20+(isiPhoneX?24:0), [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height-20-(isiPhoneX?24:0)); 230 | 231 | }]; 232 | 233 | return YES; 234 | } 235 | 236 | - (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar { 237 | if (isiPhone11) { 238 | return YES; 239 | } 240 | if ([self.navigationController viewControllers].count>0) { 241 | return YES; 242 | } 243 | if (searchBar.text.length<1) { 244 | [UIView animateWithDuration:0.2 animations:^{ 245 | mainTableView.frame = CGRectMake(0, 64+(isiPhoneX?24:0), [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height-64-(isiPhoneX?24:0)); 246 | }]; 247 | } 248 | //当按下search按钮后 后走这里,并且这之后按cancel按钮不会走这里;当没有按过search按钮,按cancel按钮会走这里 249 | return YES; 250 | } 251 | 252 | - (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar; // called when text ends editing 253 | { 254 | if (@available(iOS 13.0, *)) { 255 | if (isiPhone11) { 256 | return; 257 | } 258 | if ([self.navigationController viewControllers].count>0) { 259 | return; 260 | } 261 | 262 | if (searchBar.text.length<1) { 263 | [UIView animateWithDuration:0.2 animations:^{ 264 | mainTableView.frame = CGRectMake(0, 64+(isiPhoneX?24:0), [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height-64-(isiPhoneX?24:0)); 265 | }]; 266 | } 267 | } 268 | } 269 | 270 | - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar { 271 | if (isiPhone11) { 272 | return; 273 | } 274 | if ([self.navigationController viewControllers].count>0) { 275 | return ; 276 | } 277 | [UIView animateWithDuration:0.2 animations:^{ 278 | mainTableView.frame = CGRectMake(0, 64, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height-64); 279 | }]; 280 | } 281 | #pragma mark - UISearchDisplayDelegate 282 | - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { 283 | [self updateSearchResultsWithSearchString:searchString]; 284 | return YES; 285 | } 286 | 287 | - (void)updateSearchResultsWithSearchString:(NSString *)searchString { 288 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 289 | NSArray *tempFilterHTTPRequests = [httpRequests filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NEHTTPModel *httpRequest, NSDictionary *bindings) { 290 | return [[NSString stringWithFormat:@"%@ %d %@ %@",httpRequest.requestURLString,httpRequest.responseStatusCode,httpRequest.requestHTTPMethod,httpRequest.responseMIMEType] rangeOfString:searchString options:NSCaseInsensitiveSearch].length > 0; 291 | }]]; 292 | 293 | dispatch_async(dispatch_get_main_queue(), ^{ 294 | if ([mySearchDisplayController.searchBar.text isEqual:searchString]) { 295 | filterHTTPRequests = tempFilterHTTPRequests; 296 | [mySearchDisplayController.searchResultsTableView reloadData]; 297 | } 298 | if ([mySearchController.searchBar.text isEqual:searchString]) { 299 | filterHTTPRequests = tempFilterHTTPRequests; 300 | [mainTableView reloadData]; 301 | } 302 | }); 303 | }); 304 | } 305 | 306 | #pragma mark - UISearchControllerDelegate 307 | 308 | - (void)updateSearchResultsForSearchController:(UISearchController *)searchController; 309 | { 310 | [self updateSearchResultsWithSearchString:searchController.searchBar.text]; 311 | 312 | } 313 | 314 | - (void)didReceiveMemoryWarning { 315 | [super didReceiveMemoryWarning]; 316 | // Dispose of any resources that can be recreated. 317 | } 318 | 319 | #pragma mark - private methods 320 | - (NEHTTPModel *)modelForTableView:(UITableView *)tableView atIndexPath:(NSIndexPath *)indexPath { 321 | NEHTTPModel *currenModel=[[NEHTTPModel alloc] init]; 322 | if (tableView == mySearchDisplayController.searchResultsTableView || (mySearchController.isActive && mySearchController.searchBar.text.length > 0)) { 323 | currenModel=(NEHTTPModel *)((filterHTTPRequests)[indexPath.row]); 324 | }else{ 325 | currenModel=(NEHTTPModel *)((httpRequests)[indexPath.row]); 326 | } 327 | return currenModel; 328 | } 329 | 330 | - (NSString *)hardwareString { 331 | int name[] = {CTL_HW,HW_MACHINE}; 332 | size_t size = 100; 333 | sysctl(name, 2, NULL, &size, NULL, 0); // getting size of answer 334 | char *hw_machine = malloc(size); 335 | 336 | sysctl(name, 2, hw_machine, &size, NULL, 0); 337 | NSString *hardware = [NSString stringWithUTF8String:hw_machine]; 338 | free(hw_machine); 339 | return hardware; 340 | } 341 | 342 | @end 343 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEHTTPModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // NEHTTPModel.h 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/4. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | NS_ASSUME_NONNULL_BEGIN 11 | @interface NEHTTPModel : NSObject 12 | 13 | @property (nonatomic,strong) NSURLRequest *ne_request; 14 | @property (nonatomic,strong) NSHTTPURLResponse *ne_response; 15 | @property (nonatomic,assign) double myID; 16 | @property (nonatomic,strong) NSString *startDateString; 17 | @property (nonatomic,strong) NSString *endDateString; 18 | 19 | //request 20 | @property (nonatomic,strong) NSString *requestURLString; 21 | @property (nonatomic,strong) NSString *requestCachePolicy; 22 | @property (nonatomic,assign) double requestTimeoutInterval; 23 | @property (nonatomic,nullable, strong) NSString *requestHTTPMethod; 24 | @property (nonatomic,nullable,strong) NSString *requestAllHTTPHeaderFields; 25 | @property (nonatomic,nullable,strong) NSString *requestHTTPBody; 26 | 27 | //response 28 | @property (nonatomic,nullable,strong) NSString *responseMIMEType; 29 | @property (nonatomic,strong) NSString * responseExpectedContentLength; 30 | @property (nonatomic,nullable,strong) NSString *responseTextEncodingName; 31 | @property (nullable, nonatomic, strong) NSString *responseSuggestedFilename; 32 | @property (nonatomic,assign) int responseStatusCode; 33 | @property (nonatomic,nullable,strong) NSString *responseAllHeaderFields; 34 | 35 | //JSONData 36 | @property (nonatomic,strong) NSString *receiveJSONData; 37 | 38 | @property (nonatomic,strong) NSString *mapPath; 39 | @property (nonatomic,strong) NSString *mapJSONData; 40 | 41 | @end 42 | NS_ASSUME_NONNULL_END 43 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEHTTPModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // NEHTTPModel.m 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/4. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "NEHTTPModel.h" 10 | 11 | @implementation NEHTTPModel 12 | @synthesize ne_request,ne_response; 13 | 14 | -(void)setNe_request:(NSURLRequest *)ne_request_new{ 15 | ne_request=ne_request_new; 16 | self.requestURLString=[ne_request.URL absoluteString]; 17 | 18 | switch (ne_request.cachePolicy) { 19 | case 0: 20 | self.requestCachePolicy=@"NSURLRequestUseProtocolCachePolicy"; 21 | break; 22 | case 1: 23 | self.requestCachePolicy=@"NSURLRequestReloadIgnoringLocalCacheData"; 24 | break; 25 | case 2: 26 | self.requestCachePolicy=@"NSURLRequestReturnCacheDataElseLoad"; 27 | break; 28 | case 3: 29 | self.requestCachePolicy=@"NSURLRequestReturnCacheDataDontLoad"; 30 | break; 31 | case 4: 32 | self.requestCachePolicy=@"NSURLRequestUseProtocolCachePolicy"; 33 | break; 34 | case 5: 35 | self.requestCachePolicy=@"NSURLRequestReloadRevalidatingCacheData"; 36 | break; 37 | default: 38 | self.requestCachePolicy=@""; 39 | break; 40 | } 41 | 42 | self.requestTimeoutInterval=[[NSString stringWithFormat:@"%.1lf",ne_request.timeoutInterval] doubleValue]; 43 | self.requestHTTPMethod=ne_request.HTTPMethod; 44 | 45 | for (NSString *key in [ne_request.allHTTPHeaderFields allKeys]) { 46 | self.requestAllHTTPHeaderFields=[NSString stringWithFormat:@"%@%@",self.requestAllHTTPHeaderFields,[self formateRequestHeaderFieldKey:key object:[ne_request.allHTTPHeaderFields objectForKey:key]]]; 47 | } 48 | 49 | [self appendCookieStringAfterRequestAllHTTPHeaderFields]; 50 | 51 | if (self.requestAllHTTPHeaderFields.length>1) { 52 | if ([[self.requestAllHTTPHeaderFields substringFromIndex:self.requestAllHTTPHeaderFields.length-1] isEqualToString:@"\n"]) { 53 | self.requestAllHTTPHeaderFields=[self.requestAllHTTPHeaderFields substringToIndex:self.requestAllHTTPHeaderFields.length-1]; 54 | } 55 | } 56 | if (self.requestAllHTTPHeaderFields.length>6) { 57 | if ([[self.requestAllHTTPHeaderFields substringToIndex:6] isEqualToString:@"(null)"]) { 58 | self.requestAllHTTPHeaderFields=[self.requestAllHTTPHeaderFields substringFromIndex:6]; 59 | } 60 | } 61 | 62 | if ([ne_request HTTPBody].length>512) { 63 | self.requestHTTPBody=@"requestHTTPBody too long"; 64 | }else{ 65 | if ([ne_request.HTTPMethod isEqualToString:@"POST"] && !ne_request.HTTPBody) { 66 | uint8_t rd[1024] = {0}; 67 | NSInputStream *stream = ne_request.HTTPBodyStream; 68 | NSMutableData *data = [[NSMutableData alloc] init]; 69 | [stream open]; 70 | while ([stream hasBytesAvailable]) { 71 | NSInteger len = [stream read:rd maxLength:1024]; 72 | if (len > 0 && stream.streamError == nil) { 73 | [data appendBytes:(void *)rd length:len]; 74 | } 75 | } 76 | self.requestHTTPBody=[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 77 | [stream close]; 78 | }else{ 79 | self.requestHTTPBody=[[NSString alloc] initWithData:[ne_request HTTPBody] encoding:NSUTF8StringEncoding]; 80 | } 81 | } 82 | if (self.requestHTTPBody.length>1) { 83 | if ([[self.requestHTTPBody substringFromIndex:self.requestHTTPBody.length-1] isEqualToString:@"\n"]) { 84 | self.requestHTTPBody=[self.requestHTTPBody substringToIndex:self.requestHTTPBody.length-1]; 85 | } 86 | } 87 | 88 | } 89 | 90 | - (void)setNe_response:(NSHTTPURLResponse *)ne_response_new { 91 | 92 | ne_response=ne_response_new; 93 | 94 | self.responseMIMEType=@""; 95 | self.responseExpectedContentLength=@""; 96 | self.responseTextEncodingName=@""; 97 | self.responseSuggestedFilename=@""; 98 | self.responseStatusCode=200; 99 | self.responseAllHeaderFields=@""; 100 | 101 | self.responseMIMEType=[ne_response MIMEType]; 102 | self.responseExpectedContentLength=[NSString stringWithFormat:@"%lld",[ne_response expectedContentLength]]; 103 | self.responseTextEncodingName=[ne_response textEncodingName]; 104 | self.responseSuggestedFilename=[ne_response suggestedFilename]; 105 | self.responseStatusCode=(int)ne_response.statusCode; 106 | 107 | for (NSString *key in [ne_response.allHeaderFields allKeys]) { 108 | NSString *headerFieldValue=[ne_response.allHeaderFields objectForKey:key]; 109 | if ([key isEqualToString:@"Content-Security-Policy"]) { 110 | if (headerFieldValue.length > 12 && [[headerFieldValue substringFromIndex:12] isEqualToString:@"'none'"]) { 111 | headerFieldValue=[headerFieldValue substringToIndex:11]; 112 | } 113 | } 114 | self.responseAllHeaderFields=[NSString stringWithFormat:@"%@%@:%@\n",self.responseAllHeaderFields,key,headerFieldValue]; 115 | 116 | } 117 | 118 | if (self.responseAllHeaderFields.length>1) { 119 | if ([[self.responseAllHeaderFields substringFromIndex:self.responseAllHeaderFields.length-1] isEqualToString:@"\n"]) { 120 | self.responseAllHeaderFields=[self.responseAllHeaderFields substringToIndex:self.responseAllHeaderFields.length-1]; 121 | } 122 | } 123 | 124 | } 125 | 126 | - (void)appendCookieStringAfterRequestAllHTTPHeaderFields 127 | { 128 | NSString *host = self.ne_request.URL.host; 129 | NSArray *cookieArray = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]; 130 | NSMutableArray *cookieValueArray = [NSMutableArray array]; 131 | for (NSHTTPCookie *cookie in cookieArray) { 132 | NSString *domain = [cookie.properties valueForKey:NSHTTPCookieDomain]; 133 | NSRange range = [host rangeOfString:domain]; 134 | NSComparisonResult result = [cookie.expiresDate compare:[NSDate date]]; 135 | 136 | if(range.location != NSNotFound && result == NSOrderedDescending) 137 | { 138 | [cookieValueArray addObject:[NSString stringWithFormat:@"%@=%@",cookie.name,cookie.value]]; 139 | } 140 | } 141 | if(cookieValueArray.count > 0) 142 | { 143 | NSString *cookieString = [cookieValueArray componentsJoinedByString:@";"]; 144 | 145 | self.requestAllHTTPHeaderFields = [self.requestAllHTTPHeaderFields stringByAppendingString:[self formateRequestHeaderFieldKey:@"Cookie" object:cookieString]]; 146 | } 147 | } 148 | 149 | - (NSString *)formateRequestHeaderFieldKey:(NSString *)key object:(id)obj 150 | { 151 | return [NSString stringWithFormat:@"%@:%@\n",key?:@"",obj?:@""]; 152 | } 153 | 154 | @end 155 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEHTTPModelManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // NEHTTPModelManager.h 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/4. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "NEHTTPEye.h" 12 | @class NEHTTPModel; 13 | @interface NEHTTPModelManager : NSObject 14 | { 15 | NSMutableArray *allRequests; 16 | BOOL enablePersistent; 17 | } 18 | 19 | @property(nonatomic,strong) NSString *sqlitePassword; 20 | @property(nonatomic,assign) int saveRequestMaxCount; 21 | 22 | /** 23 | * get recorded requests 's SQLite filename 24 | * 25 | * @return filename 26 | */ 27 | + (NSString *)filename; 28 | 29 | /** 30 | * get NEHTTPModelManager's singleton object 31 | * 32 | * @return singleton object 33 | */ 34 | + (NEHTTPModelManager *)defaultManager; 35 | 36 | /** 37 | * create NEHTTPModel table 38 | */ 39 | - (void)createTable; 40 | 41 | 42 | /** 43 | * add a NEHTTPModel object to SQLite 44 | * 45 | * @param aModel a NEHTTPModel object 46 | */ 47 | - (void)addModel:(NEHTTPModel *) aModel; 48 | 49 | /** 50 | * get SQLite all NEHTTPModel object 51 | * 52 | * @return all NEHTTPModel object 53 | */ 54 | - (NSMutableArray *)allobjects; 55 | 56 | /** 57 | * delete all SQLite records 58 | */ 59 | - (void) deleteAllItem; 60 | 61 | - (NSMutableArray *)allMapObjects; 62 | - (void)addMapObject:(NEHTTPModel *)mapReq; 63 | - (void)removeMapObject:(NEHTTPModel *)mapReq; 64 | - (void)removeAllMapObjects; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEHTTPModelManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // NEHTTPModelManager.m 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/4. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "NEHTTPModelManager.h" 10 | 11 | #import "NEShakeGestureManager.h" 12 | #import "NEHTTPModel.h" 13 | #if FMDB_SQLCipher 14 | #include "sqlite3.h" 15 | #import "FMDB.h" 16 | #endif 17 | #define kSTRDoubleMarks @"\"" 18 | #define kSQLDoubleMarks @"\"\"" 19 | #define kSTRShortMarks @"'" 20 | #define kSQLShortMarks @"''" 21 | @interface NEHTTPModelManager(){ 22 | NSMutableArray *allMapRequests; 23 | #if FMDB_SQLCipher 24 | FMDatabaseQueue *sqliteDatabase; 25 | #endif 26 | 27 | } 28 | @end 29 | 30 | @implementation NEHTTPModelManager 31 | 32 | - (id)init { 33 | self = [super init]; 34 | if (self) { 35 | _sqlitePassword=kSQLitePassword; 36 | self.saveRequestMaxCount=kSaveRequestMaxCount; 37 | allRequests = [NSMutableArray arrayWithCapacity:1]; 38 | allMapRequests = [NSMutableArray arrayWithCapacity:1]; 39 | #if FMDB_SQLCipher 40 | enablePersistent = YES; 41 | #else 42 | enablePersistent = NO; 43 | 44 | #endif 45 | } 46 | return self; 47 | } 48 | 49 | + (NEHTTPModelManager *)defaultManager { 50 | 51 | static NEHTTPModelManager *staticManager; 52 | static dispatch_once_t onceToken; 53 | dispatch_once(&onceToken, ^{ 54 | staticManager=[[NEHTTPModelManager alloc] init]; 55 | [staticManager createTable]; 56 | }); 57 | return staticManager; 58 | 59 | } 60 | 61 | + (NSString *)filename { 62 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); 63 | NSString *ducumentsDirectory = [paths objectAtIndex:0]; 64 | NSString *str=[[NSString alloc] initWithFormat:@"%@/networkeye.sqlite",ducumentsDirectory]; 65 | return str; 66 | } 67 | 68 | - (void)createTable { 69 | 70 | NSMutableString *init_sqls=[NSMutableString stringWithCapacity:1024]; 71 | [init_sqls appendFormat:@"create table if not exists nenetworkhttpeyes(myID double primary key,startDateString text,endDateString text,requestURLString text,requestCachePolicy text,requestTimeoutInterval double,requestHTTPMethod text,requestAllHTTPHeaderFields text,requestHTTPBody text,responseMIMEType text,responseExpectedContentLength text,responseTextEncodingName text,responseSuggestedFilename text,responseStatusCode int,responseAllHeaderFields text,receiveJSONData text);"]; 72 | #if FMDB_SQLCipher 73 | 74 | FMDatabaseQueue *queue= [FMDatabaseQueue databaseQueueWithPath:[NEHTTPModelManager filename]]; 75 | [queue inDatabase:^(FMDatabase *db) { 76 | [db setKey:_sqlitePassword]; 77 | [db executeUpdate:init_sqls]; 78 | }]; 79 | #endif 80 | } 81 | 82 | - (void)addModel:(NEHTTPModel *) aModel { 83 | 84 | if ([aModel.responseMIMEType isEqualToString:@"text/html"]) { 85 | aModel.receiveJSONData=@""; 86 | } 87 | 88 | if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"nenetworkhttpeyecache"] isEqualToString:@"a"]) { 89 | [self deleteAllItem]; 90 | [[NSUserDefaults standardUserDefaults] setObject:@"b" forKey:@"nenetworkhttpeyecache"]; 91 | } 92 | 93 | BOOL isNull; 94 | isNull=(aModel.receiveJSONData==nil); 95 | if (isNull) { 96 | aModel.receiveJSONData=@""; 97 | } 98 | NSString *receiveJSONData; 99 | receiveJSONData=[self stringToSQLFilter:aModel.receiveJSONData]; 100 | NSString *sql=[NSString stringWithFormat:@"insert into nenetworkhttpeyes values('%lf','%@','%@','%@','%@','%lf','%@','%@','%@','%@','%@','%@','%@','%d','%@','%@')",aModel.myID,aModel.startDateString,aModel.endDateString,aModel.requestURLString,aModel.requestCachePolicy,aModel.requestTimeoutInterval,aModel.requestHTTPMethod,aModel.requestAllHTTPHeaderFields,aModel.requestHTTPBody,aModel.responseMIMEType,aModel.responseExpectedContentLength,aModel.responseTextEncodingName,aModel.responseSuggestedFilename,aModel.responseStatusCode,[self stringToSQLFilter:aModel.responseAllHeaderFields],receiveJSONData]; 101 | if (enablePersistent) { 102 | #if FMDB_SQLCipher 103 | 104 | FMDatabaseQueue *queue= [FMDatabaseQueue databaseQueueWithPath:[NEHTTPModelManager filename]]; 105 | [queue inDatabase:^(FMDatabase *db) { 106 | [db setKey:_sqlitePassword]; 107 | [db executeUpdate:sql]; 108 | }]; 109 | #endif 110 | }else { 111 | [allRequests addObject:aModel]; 112 | } 113 | 114 | return ; 115 | 116 | } 117 | 118 | - (NSMutableArray *)allobjects { 119 | 120 | if (!enablePersistent) { 121 | if (allRequests.count>=self.saveRequestMaxCount) { 122 | [[NSUserDefaults standardUserDefaults] setObject:@"a" forKey:@"nenetworkhttpeyecache"]; 123 | } 124 | return allRequests; 125 | } 126 | #if FMDB_SQLCipher 127 | 128 | FMDatabaseQueue *queue= [FMDatabaseQueue databaseQueueWithPath:[NEHTTPModelManager filename]]; 129 | NSString *sql =[NSString stringWithFormat:@"select * from nenetworkhttpeyes order by myID desc"]; 130 | NSMutableArray *array=[NSMutableArray array]; 131 | [queue inDatabase:^(FMDatabase *db) { 132 | [db setKey:_sqlitePassword]; 133 | FMResultSet *rs = [db executeQuery:sql]; 134 | while ([rs next]) { 135 | NEHTTPModel *model=[[NEHTTPModel alloc] init]; 136 | model.myID=[rs doubleForColumn:@"myID"]; 137 | model.startDateString=[rs stringForColumn:@"startDateString"]; 138 | model.endDateString=[rs stringForColumn:@"endDateString"]; 139 | model.requestURLString=[rs stringForColumn:@"requestURLString"]; 140 | model.requestCachePolicy=[rs stringForColumn:@"requestCachePolicy"]; 141 | model.requestTimeoutInterval=[rs doubleForColumn:@"requestTimeoutInterval"]; 142 | model.requestHTTPMethod=[rs stringForColumn:@"requestHTTPMethod"]; 143 | model.requestAllHTTPHeaderFields=[rs stringForColumn:@"requestAllHTTPHeaderFields"]; 144 | model.requestHTTPBody=[rs stringForColumn:@"requestHTTPBody"]; 145 | model.responseMIMEType=[rs stringForColumn:@"responseMIMEType"]; 146 | model.responseExpectedContentLength=[rs stringForColumn:@"responseExpectedContentLength"]; 147 | model.responseTextEncodingName=[rs stringForColumn:@"responseTextEncodingName"]; 148 | model.responseSuggestedFilename=[rs stringForColumn:@"responseSuggestedFilename"]; 149 | model.responseStatusCode=[rs intForColumn:@"responseStatusCode"]; 150 | model.responseAllHeaderFields=[self stringToSQLFilter:[rs stringForColumn:@"responseAllHeaderFields"]]; 151 | model.receiveJSONData=[self stringToOBJFilter:[rs stringForColumn:@"receiveJSONData"]]; 152 | [array addObject:model]; 153 | } 154 | }]; 155 | 156 | if (array.count>=self.saveRequestMaxCount) { 157 | [[NSUserDefaults standardUserDefaults] setObject:@"a" forKey:@"nenetworkhttpeyecache"]; 158 | } 159 | 160 | return array; 161 | #endif 162 | return nil; 163 | } 164 | 165 | - (void) deleteAllItem { 166 | 167 | if (!enablePersistent) { 168 | [allRequests removeAllObjects]; 169 | return; 170 | } 171 | NSString *sql=[NSString stringWithFormat:@"delete from nenetworkhttpeyes"]; 172 | #if FMDB_SQLCipher 173 | 174 | FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:[NEHTTPModelManager filename]]; 175 | [queue inDatabase:^(FMDatabase *db) { 176 | [db setKey:_sqlitePassword]; 177 | [db executeUpdate:sql]; 178 | }]; 179 | 180 | return ; 181 | #endif 182 | } 183 | 184 | #pragma mark - map local 185 | 186 | - (NSMutableArray *)allMapObjects { 187 | return allMapRequests; 188 | } 189 | 190 | - (void)addMapObject:(NEHTTPModel *)mapReq { 191 | 192 | for (NSInteger i=0; i < allMapRequests.count; i++) { 193 | NEHTTPModel *req = [allMapRequests objectAtIndex:i]; 194 | if (![mapReq.mapPath isEqualToString:req.mapPath]) { 195 | [allMapRequests replaceObjectAtIndex:i withObject:mapReq]; 196 | return; 197 | } 198 | } 199 | [allMapRequests addObject:mapReq]; 200 | } 201 | 202 | - (void)removeMapObject:(NEHTTPModel *)mapReq { 203 | 204 | for (NSInteger i=0; i < allMapRequests.count; i++) { 205 | NEHTTPModel *req = [allMapRequests objectAtIndex:i]; 206 | if ([mapReq.mapPath isEqualToString:req.mapPath]) { 207 | [allMapRequests removeObject:mapReq]; 208 | return; 209 | } 210 | } 211 | } 212 | 213 | - (void)removeAllMapObjects { 214 | [allMapRequests removeAllObjects]; 215 | } 216 | 217 | #pragma mark - Utils 218 | 219 | - (id)stringToSQLFilter:(id)str { 220 | 221 | if ( [str respondsToSelector:@selector(stringByReplacingOccurrencesOfString:withString:)]) { 222 | id temp = str; 223 | temp = [temp stringByReplacingOccurrencesOfString:kSTRShortMarks withString:kSQLShortMarks]; 224 | temp = [temp stringByReplacingOccurrencesOfString:kSTRDoubleMarks withString:kSQLDoubleMarks]; 225 | return temp; 226 | } 227 | return str; 228 | 229 | } 230 | 231 | - (id)stringToOBJFilter:(id)str { 232 | 233 | if ( [str respondsToSelector:@selector(stringByReplacingOccurrencesOfString:withString:)]) { 234 | id temp = str; 235 | temp = [temp stringByReplacingOccurrencesOfString:kSQLShortMarks withString:kSTRShortMarks]; 236 | temp = [temp stringByReplacingOccurrencesOfString:kSQLDoubleMarks withString:kSTRDoubleMarks]; 237 | return temp; 238 | } 239 | return str; 240 | 241 | } 242 | 243 | @end 244 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEKeyboardShortcutManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // NEKeyboardShortcutManager.h 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 2016/10/15. 6 | // Copyright © 2016年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #if TARGET_OS_SIMULATOR 13 | 14 | @interface NEKeyboardShortcutManager : NSObject 15 | @property (nonatomic, assign, getter=isEnabled) BOOL enabled; 16 | 17 | + (instancetype)sharedManager; 18 | 19 | - (void)registerSimulatorShortcutWithKey:(NSString *)key modifiers:(UIKeyModifierFlags)modifiers action:(dispatch_block_t)action description:(NSString *)description; 20 | 21 | @end 22 | #endif 23 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEKeyboardShortcutManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // NEKeyboardShortcutManager.m 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 2016/10/15. 6 | // Copyright © 2016年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "NEKeyboardShortcutManager.h" 10 | #import 11 | #import 12 | 13 | #if TARGET_OS_SIMULATOR 14 | 15 | 16 | @interface UIEvent (UIPhysicalKeyboardEvent) 17 | 18 | @property (nonatomic, strong) NSString *_modifiedInput; 19 | @property (nonatomic, strong) NSString *_unmodifiedInput; 20 | @property (nonatomic, assign) UIKeyModifierFlags _modifierFlags; 21 | @property (nonatomic, assign) BOOL _isKeyDown; 22 | @property (nonatomic, assign) long _keyCode; 23 | 24 | @end 25 | 26 | @interface NEKeyInput : NSObject 27 | 28 | @property (nonatomic, copy, readonly) NSString *key; 29 | @property (nonatomic, assign, readonly) UIKeyModifierFlags flags; 30 | 31 | @end 32 | 33 | @implementation NEKeyInput 34 | 35 | - (BOOL)isEqual:(id)object 36 | { 37 | BOOL isEqual = NO; 38 | if ([object isKindOfClass:[NEKeyInput class]]) { 39 | NEKeyInput *keyCommand = (NEKeyInput *)object; 40 | BOOL equalKeys = self.key == keyCommand.key || [self.key isEqual:keyCommand.key]; 41 | BOOL equalFlags = self.flags == keyCommand.flags; 42 | isEqual = equalKeys && equalFlags; 43 | } 44 | return isEqual; 45 | } 46 | 47 | - (NSUInteger)hash 48 | { 49 | return [self.key hash] ^ self.flags; 50 | } 51 | 52 | - (id)copyWithZone:(NSZone *)zone 53 | { 54 | return [[self class] keyInputForKey:self.key flags:self.flags]; 55 | } 56 | 57 | 58 | + (instancetype)keyInputForKey:(NSString *)key flags:(UIKeyModifierFlags)flags 59 | { 60 | NEKeyInput *keyInput = [[self alloc] init]; 61 | if (keyInput) { 62 | keyInput->_key = key; 63 | keyInput->_flags = flags; 64 | } 65 | return keyInput; 66 | } 67 | 68 | @end 69 | 70 | @interface NEKeyboardShortcutManager () 71 | 72 | @property (nonatomic, strong) NSMutableDictionary *actionsForKeyInputs; 73 | 74 | @property (nonatomic, assign, getter=isPressingShift) BOOL pressingShift; 75 | @property (nonatomic, assign, getter=isPressingCommand) BOOL pressingCommand; 76 | @property (nonatomic, assign, getter=isPressingControl) BOOL pressingControl; 77 | 78 | @end 79 | 80 | @implementation NEKeyboardShortcutManager 81 | 82 | + (instancetype)sharedManager 83 | { 84 | static NEKeyboardShortcutManager *sharedManager = nil; 85 | static dispatch_once_t onceToken; 86 | dispatch_once(&onceToken, ^{ 87 | sharedManager = [[[self class] alloc] init]; 88 | }); 89 | return sharedManager; 90 | } 91 | 92 | + (void)load 93 | { 94 | SEL originalKeyEventSelector = NSSelectorFromString(@"handleKeyUIEvent:"); 95 | SEL swizzledKeyEventSelector = [NEKeyboardShortcutManager swizzledSelectorForSelector:originalKeyEventSelector]; 96 | 97 | void (^handleKeyUIEventSwizzleBlock)(UIApplication *, UIEvent *) = ^(UIApplication *slf, UIEvent *event) { 98 | 99 | [[[self class] sharedManager] handleKeyboardEvent:event]; 100 | 101 | ((void(*)(id, SEL, id))objc_msgSend)(slf, swizzledKeyEventSelector, event); 102 | }; 103 | 104 | [NEKeyboardShortcutManager replaceImplementationOfKnownSelector:originalKeyEventSelector onClass:[UIApplication class] withBlock:handleKeyUIEventSwizzleBlock swizzledSelector:swizzledKeyEventSelector]; 105 | 106 | if ([[UITouch class] instancesRespondToSelector:@selector(maximumPossibleForce)]) { 107 | SEL originalSendEventSelector = NSSelectorFromString(@"sendEvent:"); 108 | SEL swizzledSendEventSelector = [NEKeyboardShortcutManager swizzledSelectorForSelector:originalSendEventSelector]; 109 | 110 | void (^sendEventSwizzleBlock)(UIApplication *, UIEvent *) = ^(UIApplication *slf, UIEvent *event) { 111 | if (event.type == UIEventTypeTouches) { 112 | NEKeyboardShortcutManager *keyboardManager = [NEKeyboardShortcutManager sharedManager]; 113 | NSInteger pressureLevel = 0; 114 | if (keyboardManager.isPressingShift) { 115 | pressureLevel++; 116 | } 117 | if (keyboardManager.isPressingCommand) { 118 | pressureLevel++; 119 | } 120 | if (keyboardManager.isPressingControl) { 121 | pressureLevel++; 122 | } 123 | if (pressureLevel > 0) { 124 | for (UITouch *touch in [event allTouches]) { 125 | double adjustedPressureLevel = pressureLevel * 20 * touch.maximumPossibleForce; 126 | [touch setValue:@(adjustedPressureLevel) forKey:@"_pressure"]; 127 | } 128 | } 129 | } 130 | 131 | ((void(*)(id, SEL, id))objc_msgSend)(slf, swizzledSendEventSelector, event); 132 | }; 133 | 134 | [NEKeyboardShortcutManager replaceImplementationOfKnownSelector:originalSendEventSelector onClass:[UIApplication class] withBlock:sendEventSwizzleBlock swizzledSelector:swizzledSendEventSelector]; 135 | 136 | SEL originalSupportsTouchPressureSelector = NSSelectorFromString(@"_supportsForceTouch"); 137 | SEL swizzledSupportsTouchPressureSelector = [NEKeyboardShortcutManager swizzledSelectorForSelector:originalSupportsTouchPressureSelector]; 138 | 139 | BOOL (^supportsTouchPressureSwizzleBlock)(UIDevice *) = ^BOOL(UIDevice *slf) { 140 | return YES; 141 | }; 142 | 143 | [NEKeyboardShortcutManager replaceImplementationOfKnownSelector:originalSupportsTouchPressureSelector onClass:[UIDevice class] withBlock:supportsTouchPressureSwizzleBlock swizzledSelector:swizzledSupportsTouchPressureSelector]; 144 | } 145 | } 146 | 147 | - (instancetype)init 148 | { 149 | self = [super init]; 150 | 151 | if (self) { 152 | _actionsForKeyInputs = [NSMutableDictionary dictionary]; 153 | _enabled = YES; 154 | } 155 | 156 | return self; 157 | } 158 | 159 | - (void)registerSimulatorShortcutWithKey:(NSString *)key modifiers:(UIKeyModifierFlags)modifiers action:(dispatch_block_t)action description:(NSString *)description 160 | { 161 | NEKeyInput *keyInput = [NEKeyInput keyInputForKey:key flags:modifiers]; 162 | [self.actionsForKeyInputs setObject:action forKey:keyInput]; 163 | } 164 | 165 | static const long kNEControlKeyCode = 0xe0; 166 | static const long kNEShiftKeyCode = 0xe1; 167 | static const long kNECommandKeyCode = 0xe3; 168 | 169 | - (void)handleKeyboardEvent:(UIEvent *)event 170 | { 171 | if (!self.enabled) { 172 | return; 173 | } 174 | 175 | NSString *modifiedInput = nil; 176 | NSString *unmodifiedInput = nil; 177 | UIKeyModifierFlags flags = 0; 178 | BOOL isKeyDown = NO; 179 | 180 | if ([event respondsToSelector:@selector(_modifiedInput)]) { 181 | modifiedInput = [event _modifiedInput]; 182 | } 183 | 184 | if ([event respondsToSelector:@selector(_unmodifiedInput)]) { 185 | unmodifiedInput = [event _unmodifiedInput]; 186 | } 187 | 188 | if ([event respondsToSelector:@selector(_modifierFlags)]) { 189 | flags = [event _modifierFlags]; 190 | } 191 | 192 | if ([event respondsToSelector:@selector(_isKeyDown)]) { 193 | isKeyDown = [event _isKeyDown]; 194 | } 195 | 196 | BOOL interactionEnabled = ![[UIApplication sharedApplication] isIgnoringInteractionEvents]; 197 | BOOL hasFirstResponder = NO; 198 | if (isKeyDown && [modifiedInput length] > 0 && interactionEnabled) { 199 | UIResponder *firstResponder = nil; 200 | for (UIWindow *window in [NEKeyboardShortcutManager allWindows]) { 201 | firstResponder = [window valueForKey:@"firstResponder"]; 202 | if (firstResponder) { 203 | hasFirstResponder = YES; 204 | break; 205 | } 206 | } 207 | 208 | if (firstResponder) { 209 | if ([unmodifiedInput isEqual:UIKeyInputEscape]) { 210 | [firstResponder resignFirstResponder]; 211 | } 212 | } else { 213 | NEKeyInput *exactMatch = [NEKeyInput keyInputForKey:unmodifiedInput flags:flags]; 214 | 215 | dispatch_block_t actionBlock = self.actionsForKeyInputs[exactMatch]; 216 | 217 | if (!actionBlock) { 218 | NEKeyInput *shiftMatch = [NEKeyInput keyInputForKey:modifiedInput flags:flags&(!UIKeyModifierShift)]; 219 | actionBlock = self.actionsForKeyInputs[shiftMatch]; 220 | } 221 | 222 | if (!actionBlock) { 223 | NEKeyInput *capitalMatch = [NEKeyInput keyInputForKey:[unmodifiedInput uppercaseString] flags:flags]; 224 | actionBlock = self.actionsForKeyInputs[capitalMatch]; 225 | } 226 | 227 | if (actionBlock) { 228 | actionBlock(); 229 | } 230 | } 231 | } 232 | 233 | if (!hasFirstResponder && [event respondsToSelector:@selector(_keyCode)]) { 234 | long keyCode = [event _keyCode]; 235 | if (keyCode == kNEControlKeyCode) { 236 | self.pressingControl = isKeyDown; 237 | } else if (keyCode == kNECommandKeyCode) { 238 | self.pressingCommand = isKeyDown; 239 | } else if (keyCode == kNEShiftKeyCode) { 240 | self.pressingShift = isKeyDown; 241 | } 242 | } 243 | } 244 | 245 | #pragma mark Utils 246 | 247 | + (NSArray *)allWindows 248 | { 249 | BOOL includeInternalWindows = YES; 250 | BOOL onlyVisibleWindows = NO; 251 | 252 | NSArray *allWindowsComponents = @[@"al", @"lWindo", @"wsIncl", @"udingInt", @"ernalWin", @"dows:o", @"nlyVisi", @"bleWin", @"dows:"]; 253 | SEL allWindowsSelector = NSSelectorFromString([allWindowsComponents componentsJoinedByString:@""]); 254 | 255 | NSMethodSignature *methodSignature = [[UIWindow class] methodSignatureForSelector:allWindowsSelector]; 256 | NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSignature]; 257 | 258 | invocation.target = [UIWindow class]; 259 | invocation.selector = allWindowsSelector; 260 | [invocation setArgument:&includeInternalWindows atIndex:2]; 261 | [invocation setArgument:&onlyVisibleWindows atIndex:3]; 262 | [invocation invoke]; 263 | 264 | __unsafe_unretained NSArray *windows = nil; 265 | [invocation getReturnValue:&windows]; 266 | return windows; 267 | } 268 | 269 | + (SEL)swizzledSelectorForSelector:(SEL)selector 270 | { 271 | return NSSelectorFromString([NSString stringWithFormat:@"_ne_swizzle_%x_%@", arc4random(), NSStringFromSelector(selector)]); 272 | } 273 | 274 | + (void)replaceImplementationOfKnownSelector:(SEL)originalSelector onClass:(Class)class withBlock:(id)block swizzledSelector:(SEL)swizzledSelector 275 | { 276 | Method originalMethod = class_getInstanceMethod(class, originalSelector); 277 | if (!originalMethod) { 278 | return; 279 | } 280 | 281 | IMP implementation = imp_implementationWithBlock(block); 282 | class_addMethod(class, swizzledSelector, implementation, method_getTypeEncoding(originalMethod)); 283 | Method newMethod = class_getInstanceMethod(class, swizzledSelector); 284 | method_exchangeImplementations(originalMethod, newMethod); 285 | } 286 | 287 | @end 288 | 289 | 290 | #endif 291 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEMapViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NEMapViewController.h 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 16/9/25. 6 | // Copyright © 2016年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | @class NEHTTPModel; 11 | @interface NEMapViewController : UIViewController 12 | @property (nonatomic,strong) NEHTTPModel *model; 13 | @end 14 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEMapViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NEMapViewController.m 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 16/9/25. 6 | // Copyright © 2016年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "NEMapViewController.h" 10 | #import "NEHTTPModel.h" 11 | #import "NEHTTPModelManager.h" 12 | @interface NEMapViewController (){ 13 | 14 | UITextView *mainTextView; 15 | NEHTTPModel *model; 16 | } 17 | 18 | 19 | @end 20 | 21 | @implementation NEMapViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | if ([[[UIDevice currentDevice]systemVersion] floatValue] >= 7.0) { 26 | self.edgesForExtendedLayout = UIRectEdgeBottom | UIRectEdgeLeft | UIRectEdgeRight; 27 | 28 | } 29 | self.automaticallyAdjustsScrollViewInsets=NO; 30 | self.view.backgroundColor=[UIColor whiteColor]; 31 | 32 | UINavigationBar *bar=[[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 64)]; 33 | [self.view addSubview:bar]; 34 | bar.barTintColor=[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f]; 35 | 36 | UIButton *backBt=[UIButton buttonWithType:UIButtonTypeCustom]; 37 | backBt.frame=CGRectMake(10, 27, 40, 30); 38 | [backBt setTitle:@"back" forState:UIControlStateNormal]; 39 | backBt.titleLabel.font=[UIFont systemFontOfSize:15]; 40 | [backBt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 41 | [backBt addTarget:self action:@selector(backBtAction) forControlEvents:UIControlEventTouchUpInside]; 42 | [bar addSubview:backBt]; 43 | 44 | UIButton *deleteBt=[UIButton buttonWithType:UIButtonTypeCustom]; 45 | deleteBt.frame=CGRectMake([[UIScreen mainScreen] bounds].size.width-60, 27, 50, 30); 46 | [deleteBt setTitle:@"delete" forState:UIControlStateNormal]; 47 | deleteBt.titleLabel.font=[UIFont systemFontOfSize:13]; 48 | [deleteBt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 49 | [deleteBt addTarget:self action:@selector(rightAction) forControlEvents:UIControlEventTouchUpInside]; 50 | [bar addSubview:deleteBt]; 51 | 52 | 53 | UILabel *titleText = [[UILabel alloc] initWithFrame: CGRectMake(([[UIScreen mainScreen] bounds].size.width-230)/2, 20, 230, 44)]; 54 | titleText.backgroundColor = [UIColor clearColor]; 55 | titleText.textColor=[UIColor whiteColor]; 56 | [titleText setFont:[UIFont systemFontOfSize:13.0]]; 57 | titleText.textAlignment=NSTextAlignmentCenter; 58 | [bar addSubview:titleText]; 59 | NSRange requestPathRange = [_model.requestURLString rangeOfString:@"?"]; 60 | NSString *requestPath; 61 | if (requestPathRange.location == NSNotFound) { 62 | requestPath =_model.requestURLString; 63 | }else { 64 | requestPath = [_model.requestURLString substringToIndex:requestPathRange.location]; 65 | } 66 | titleText.text=requestPath; 67 | titleText.lineBreakMode = NSLineBreakByTruncatingHead; 68 | 69 | mainTextView=[[UITextView alloc] initWithFrame:CGRectMake(0, 64, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height-64)]; 70 | [self.view addSubview:mainTextView]; 71 | model = [[NEHTTPModel alloc] init]; 72 | 73 | NSArray *allMapRequests = [[NEHTTPModelManager defaultManager] allMapObjects]; 74 | for (NSInteger i=0; i < allMapRequests.count; i++) { 75 | NEHTTPModel *req = [allMapRequests objectAtIndex:i]; 76 | if ([[_model.ne_request.URL absoluteString] containsString:req.mapPath]) { 77 | mainTextView.text=req.mapJSONData; 78 | model = req; 79 | } 80 | } 81 | 82 | 83 | } 84 | 85 | - (void)backBtAction { 86 | if (![[mainTextView.text stringByTrimmingCharactersInSet: 87 | [NSCharacterSet whitespaceAndNewlineCharacterSet]] isEqualToString:model.mapJSONData] && mainTextView.text.length>0) { 88 | 89 | model.mapJSONData = [mainTextView.text stringByTrimmingCharactersInSet: 90 | [NSCharacterSet whitespaceAndNewlineCharacterSet]]; 91 | NSRange requestPathRange = [_model.requestURLString rangeOfString:@"?"]; 92 | NSString *requestPath; 93 | if (requestPathRange.location == NSNotFound) { 94 | requestPath =_model.requestURLString; 95 | }else { 96 | requestPath = [_model.requestURLString substringToIndex:requestPathRange.location]; 97 | } 98 | 99 | model.mapPath = requestPath; 100 | [[NEHTTPModelManager defaultManager] addMapObject:model]; 101 | }else if (mainTextView.text.length==0) { 102 | [[NEHTTPModelManager defaultManager] removeMapObject:model]; 103 | } 104 | 105 | [self dismissViewControllerAnimated:YES completion:nil]; 106 | 107 | } 108 | 109 | - (void)rightAction { 110 | [[NEHTTPModelManager defaultManager] removeMapObject:model]; 111 | mainTextView.text=@""; 112 | 113 | } 114 | 115 | 116 | @end 117 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEShakeGestureManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // NEShakeGestureManager.h 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/5. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NEShakeGestureManager : NSObject 12 | 13 | /** 14 | * get NEShakeGestureManager's singleton object 15 | * 16 | * @return singleton object 17 | */ 18 | + (NEShakeGestureManager *)defaultManager; 19 | 20 | /** 21 | * show Go NetworkEye page 's alertView 22 | */ 23 | - (void)showAlertView; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEShakeGestureManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // NEShakeGestureManager.m 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/5. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "NEShakeGestureManager.h" 10 | 11 | #import 12 | #import "NEHTTPEyeViewController.h" 13 | 14 | @interface NEShakeGestureManager () 15 | 16 | #pragma clang diagnostic push 17 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 18 | @property (nonatomic, strong) UIAlertView *alertView; 19 | #pragma clang diagnostic pop 20 | 21 | @end 22 | 23 | @implementation NEShakeGestureManager 24 | 25 | + (NEShakeGestureManager *)defaultManager { 26 | 27 | static NEShakeGestureManager *staticManager; 28 | static dispatch_once_t onceToken; 29 | dispatch_once(&onceToken, ^{ 30 | staticManager=[[NEShakeGestureManager alloc] init]; 31 | }); 32 | return staticManager; 33 | 34 | } 35 | 36 | - (void)showAlertView { 37 | 38 | [self.alertView show]; 39 | 40 | } 41 | 42 | #pragma clang diagnostic push 43 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 44 | - (UIAlertView *)alertView { 45 | 46 | if (_alertView == nil) { 47 | _alertView = [[UIAlertView alloc] init]; 48 | _alertView.delegate = self; 49 | _alertView.title = @"Network Eye"; 50 | [_alertView addButtonWithTitle:@"Go NetworkEye"]; 51 | [_alertView addButtonWithTitle:@"Cancel"]; 52 | [_alertView setCancelButtonIndex:[_alertView numberOfButtons]-1]; 53 | } 54 | return _alertView; 55 | 56 | } 57 | #pragma clang diagnostic pop 58 | 59 | 60 | - (void)presentInformationViewController { 61 | 62 | NEHTTPEyeViewController *viewController = [[NEHTTPEyeViewController alloc] init]; 63 | [[[[[UIApplication sharedApplication] delegate] window] rootViewController] 64 | presentViewController:viewController animated:YES completion:nil]; 65 | 66 | } 67 | 68 | #pragma mark - UIAlertViewDelegate 69 | 70 | - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { 71 | 72 | NSString *buttonTitle = [alertView buttonTitleAtIndex:buttonIndex]; 73 | if ([buttonTitle isEqualToString:@"Go NetworkEye"]) { 74 | [self presentInformationViewController]; 75 | } 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEURLSessionConfiguration.h: -------------------------------------------------------------------------------- 1 | // 2 | // NEURLSessionConfiguration.h 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/9. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NEURLSessionConfiguration : NSObject 12 | @property (nonatomic,assign) BOOL isSwizzle;// whether swizzle NSURLSessionConfiguration's protocolClasses method 13 | 14 | /** 15 | * get NEURLSessionConfiguration's singleton object 16 | * 17 | * @return singleton object 18 | */ 19 | + (NEURLSessionConfiguration *)defaultConfiguration; 20 | 21 | /** 22 | * swizzle NSURLSessionConfiguration's protocolClasses method 23 | */ 24 | - (void)load; 25 | 26 | /** 27 | * make NSURLSessionConfiguration's protocolClasses method is normal 28 | */ 29 | - (void)unload; 30 | @end 31 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/NEURLSessionConfiguration.m: -------------------------------------------------------------------------------- 1 | // 2 | // NEURLSessionConfiguration.m 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/9. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "NEURLSessionConfiguration.h" 10 | #import 11 | #import "NEHTTPEye.h" 12 | 13 | @implementation NEURLSessionConfiguration 14 | 15 | + (NEURLSessionConfiguration *)defaultConfiguration { 16 | 17 | static NEURLSessionConfiguration *staticConfiguration; 18 | static dispatch_once_t onceToken; 19 | dispatch_once(&onceToken, ^{ 20 | staticConfiguration=[[NEURLSessionConfiguration alloc] init]; 21 | }); 22 | return staticConfiguration; 23 | 24 | } 25 | - (instancetype)init { 26 | self = [super init]; 27 | if (self) { 28 | self.isSwizzle=NO; 29 | } 30 | return self; 31 | } 32 | 33 | - (void)load { 34 | 35 | self.isSwizzle=YES; 36 | Class cls = NSClassFromString(@"__NSCFURLSessionConfiguration") ?: NSClassFromString(@"NSURLSessionConfiguration"); 37 | [self swizzleSelector:@selector(protocolClasses) fromClass:cls toClass:[self class]]; 38 | 39 | } 40 | 41 | - (void)unload { 42 | 43 | self.isSwizzle=NO; 44 | Class cls = NSClassFromString(@"__NSCFURLSessionConfiguration") ?: NSClassFromString(@"NSURLSessionConfiguration"); 45 | [self swizzleSelector:@selector(protocolClasses) fromClass:cls toClass:[self class]]; 46 | 47 | } 48 | 49 | - (void)swizzleSelector:(SEL)selector fromClass:(Class)original toClass:(Class)stub { 50 | 51 | Method originalMethod = class_getInstanceMethod(original, selector); 52 | Method stubMethod = class_getInstanceMethod(stub, selector); 53 | if (!originalMethod || !stubMethod) { 54 | [NSException raise:NSInternalInconsistencyException format:@"Couldn't load NEURLSessionConfiguration."]; 55 | } 56 | method_exchangeImplementations(originalMethod, stubMethod); 57 | } 58 | 59 | - (NSArray *)protocolClasses { 60 | 61 | return @[[NEHTTPEye class]];//如果需要导入其他的自定义NSURLProtocol请在这里增加,当然在使用NSURLSessionConfiguration时增加也可以 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/UIWindow+NEExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIWindow+NEExtension.h 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/14. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIWindow (NEExtension) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NetworkEye/NetworkEye/UIWindow+NEExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIWindow+NEExtension.m 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/14. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "UIWindow+NEExtension.h" 10 | #import "NEShakeGestureManager.h" 11 | 12 | @implementation UIWindow (NEExtension) 13 | 14 | #if defined(DEBUG)||defined(_DEBUG) 15 | - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { 16 | 17 | if (event.type == UIEventTypeMotion && event.subtype == UIEventSubtypeMotionShake) { 18 | [[NEShakeGestureManager defaultManager] showAlertView]; 19 | } 20 | 21 | } 22 | 23 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { 24 | 25 | int twoFingerTag=NO; 26 | if ([event allTouches].count==2) { 27 | for (UITouch *touch in [event allTouches]) { 28 | if (touch.tapCount==1) { 29 | twoFingerTag=YES; 30 | }else{ 31 | twoFingerTag=NO; 32 | } 33 | } 34 | } 35 | if (twoFingerTag) { 36 | [[NEShakeGestureManager defaultManager] showAlertView]; 37 | } 38 | 39 | } 40 | #endif 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /NetworkEye/Resources/networkeye1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NetworkEye/99cf3559393b6a337c04b999e2c23571a7b91ba2/NetworkEye/Resources/networkeye1.png -------------------------------------------------------------------------------- /NetworkEye/Resources/networkeye1_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NetworkEye/99cf3559393b6a337c04b999e2c23571a7b91ba2/NetworkEye/Resources/networkeye1_1.png -------------------------------------------------------------------------------- /NetworkEye/Resources/networkeye1_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NetworkEye/99cf3559393b6a337c04b999e2c23571a7b91ba2/NetworkEye/Resources/networkeye1_2.png -------------------------------------------------------------------------------- /NetworkEye/Resources/networkeye1_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NetworkEye/99cf3559393b6a337c04b999e2c23571a7b91ba2/NetworkEye/Resources/networkeye1_3.png -------------------------------------------------------------------------------- /NetworkEye/Resources/networkeye2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NetworkEye/99cf3559393b6a337c04b999e2c23571a7b91ba2/NetworkEye/Resources/networkeye2.png -------------------------------------------------------------------------------- /NetworkEye/Resources/networkeye3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NetworkEye/99cf3559393b6a337c04b999e2c23571a7b91ba2/NetworkEye/Resources/networkeye3.png -------------------------------------------------------------------------------- /NetworkEye/Resources/networkeye4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NetworkEye/99cf3559393b6a337c04b999e2c23571a7b91ba2/NetworkEye/Resources/networkeye4.png -------------------------------------------------------------------------------- /NetworkEye/Resources/networkeye5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NetworkEye/99cf3559393b6a337c04b999e2c23571a7b91ba2/NetworkEye/Resources/networkeye5.png -------------------------------------------------------------------------------- /NetworkEye/Resources/networkeye_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NetworkEye/99cf3559393b6a337c04b999e2c23571a7b91ba2/NetworkEye/Resources/networkeye_logo.png -------------------------------------------------------------------------------- /NetworkEye/Resources/networkeye_logo.sketch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NetworkEye/99cf3559393b6a337c04b999e2c23571a7b91ba2/NetworkEye/Resources/networkeye_logo.sketch -------------------------------------------------------------------------------- /NetworkEye/Resources/networkeye_logo_detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NetworkEye/99cf3559393b6a337c04b999e2c23571a7b91ba2/NetworkEye/Resources/networkeye_logo_detail.png -------------------------------------------------------------------------------- /NetworkEye/Resources/networkeye_logo_detail.sketch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NetworkEye/99cf3559393b6a337c04b999e2c23571a7b91ba2/NetworkEye/Resources/networkeye_logo_detail.sketch -------------------------------------------------------------------------------- /NetworkEye/Resources/networkeye_logo_detail@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NetworkEye/99cf3559393b6a337c04b999e2c23571a7b91ba2/NetworkEye/Resources/networkeye_logo_detail@1x.png -------------------------------------------------------------------------------- /NetworkEye/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // NetworkEye 4 | // 5 | // Created by coderyi on 15/11/5. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /NetworkEyeTests/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 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /NetworkEyeTests/NetworkEyeTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NetworkEyeTests.m 3 | // NetworkEyeTests 4 | // 5 | // Created by coderyi on 15/11/5. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NetworkEyeTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation NetworkEyeTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /NetworkEyeUITests/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 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /NetworkEyeUITests/NetworkEyeUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NetworkEyeUITests.m 3 | // NetworkEyeUITests 4 | // 5 | // Created by coderyi on 15/11/5. 6 | // Copyright © 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NetworkEyeUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation NetworkEyeUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '7.0' 2 | 3 | target "NetworkEye" do 4 | pod 'FMDB/SQLCipher', '~> 2.5' 5 | end -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - FMDB/common (2.5) 3 | - FMDB/SQLCipher (2.5): 4 | - FMDB/common 5 | - SQLCipher 6 | - SQLCipher (3.1.0): 7 | - SQLCipher/standard (= 3.1.0) 8 | - SQLCipher/common (3.1.0) 9 | - SQLCipher/standard (3.1.0): 10 | - SQLCipher/common 11 | 12 | DEPENDENCIES: 13 | - FMDB/SQLCipher (~> 2.5) 14 | 15 | SPEC REPOS: 16 | trunk: 17 | - FMDB 18 | - SQLCipher 19 | 20 | SPEC CHECKSUMS: 21 | FMDB: 96e8f1bcc1329e269330f99770ad4285d9003e52 22 | SQLCipher: 4684434d5791db86512cd7e02172aefba575849e 23 | 24 | PODFILE CHECKSUM: 9763126a952e181b99dc45f49b3235935404f17b 25 | 26 | COCOAPODS: 1.8.0 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NetworkEye 2 | [![Pod Version](http://img.shields.io/cocoapods/v/NetworkEye.svg?style=flat)](http://cocoadocs.org/docsets/NetworkEye/) 3 | [![Pod Platform](http://img.shields.io/cocoapods/p/NetworkEye.svg?style=flat)](http://cocoadocs.org/docsets/NetworkEye/) 4 | [![Pod License](http://img.shields.io/cocoapods/l/NetworkEye.svg?style=flat)](https://opensource.org/licenses/MIT) 5 | [![Twitter](https://img.shields.io/badge/twitter-@coderyi9-green.svg?style=flat)](http://twitter.com/coderyi9) 6 | [![](https://img.shields.io/github/stars/coderyi/NetworkEye.svg)](https://github.com/coderyi/NetworkEye/stargazers) 7 | [![](https://img.shields.io/github/forks/coderyi/NetworkEye.svg)](https://github.com/coderyi/NetworkEye/network) 8 | [![](https://img.shields.io/cocoapods/dt/NetworkEye.svg?maxAge=2592000)](https://github.com/coderyi/NetworkEye) 9 | [![](https://img.shields.io/cocoapods/dm/NetworkEye.svg?maxAge=2592000)](https://github.com/coderyi/NetworkEye) 10 | [![](https://img.shields.io/cocoapods/dw/NetworkEye.svg?maxAge=2592000)](https://github.com/coderyi/NetworkEye) 11 | 12 |

13 | 14 | 15 |

16 | 17 | [README 中文](https://github.com/coderyi/NetworkEye/blob/master/README_Chinese.md) 18 | 19 | NetworkEye,a iOS network debug library,monitor HTTP requests. 20 | 21 | It can be detected HTTP request include web pages, NSURLConnection, NSURLSession, AFNetworking, 3rd libraries, 3rd SDK ,and so on. very convenient and practical. 22 | 23 | It can be map local json file. 24 | 25 | I created a google group,this group is for general discussion NetworkEye 26 | ,welcome to join,[https://groups.google.com/d/forum/networkeye](https://groups.google.com/d/forum/networkeye) 27 | 28 | if you use NetworkEye, you can add it in here,[Who-Uses-NetworkEye](https://github.com/coderyi/NetworkEye/wiki/Who-Uses-NetworkEye) 29 | 30 | welcome to new pull request,that fix bug,add new features,add support other platform.and welcome to [new issues](https://github.com/coderyi/NetworkEye/issues). 31 | 32 | and thanks to [kasketis](https://github.com/kasketis) write the swift version [netfox](https://github.com/kasketis/netfox) 33 | 34 | 35 | #### Podfile 36 | 37 | ```ruby 38 | 39 | platform :ios, '7.0' 40 | pod 'NetworkEye', '~> 1.1.2' 41 | # pod 'NetworkEye/FMDB', '~> 1.1.2' # NetworkEye with FMDB ,save your requests to database 42 | 43 | ``` 44 | 45 | 46 | #### Instruction 47 | Note:Use Network Eye in DEBUG mode 48 | 49 | add the code in AppDelegate.m 50 |
 51 | #import "NEHTTPEye.h"
 52 | #if defined(DEBUG)||defined(_DEBUG)
 53 |     [NEHTTPEye setEnabled:YES];
 54 | #endif
 55 | 
56 | 57 | you can use use the shortcut (⌘ Command + n) , a double tap or shake device to call out the monitoring data interface 58 | 59 | NEHTTPEyeViewController 60 | 61 | You can also use the following code 62 |
 63 | #if defined(DEBUG)||defined(_DEBUG)
 64 |     NEHTTPEyeViewController *vc=[[NEHTTPEyeViewController alloc] init];
 65 |     [self presentViewController:vc animated:YES completion:nil];
 66 | #endif
 67 | 
68 | In NEHTTPEye, the default password of database is "networkeye" ,and you can save 300 requests. 69 | 70 | 71 | the database name is networkeye.sqlite,and stored in the cache directory. 72 | 73 |
 74 | #define kSQLitePassword @"networkeye"
 75 | 
 76 | #define kSaveRequestMaxCount 300
 77 | 
78 | 79 | you can change it use NEHTTPModelManager 80 |
 81 |     [NEHTTPModelManager defaultManager].saveRequestMaxCount=300;
 82 |     [NEHTTPModelManager defaultManager].sqlitePassword=@"networkeye";
 83 | 
84 | NetworkEye use FMDB and SQLCipher。 85 | FMDB is used to store data,SQLCipher is used to encrypt the database。 86 | 87 | Monitoring data interface supports some search conditions ,it is URL,statusCode,HTTPMethod,MIMEType。 88 | #### Preview 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | #### Licenses 99 | 100 | [MIT License](https://github.com/coderyi/NetworkEye/blob/master/LICENSE). 101 | 102 | #### Contributors 103 | 104 | thanks! 105 | 106 | [Xi Lin](https://github.com/xilin) 107 | 108 | [Zhu Lida](https://github.com/zld) 109 | 110 | [Jackrex](https://github.com/jackrex) 111 | 112 | -------------------------------------------------------------------------------- /README_Chinese.md: -------------------------------------------------------------------------------- 1 | # NetworkEye 2 | [![Pod Version](http://img.shields.io/cocoapods/v/NetworkEye.svg?style=flat)](http://cocoadocs.org/docsets/NetworkEye/) 3 | [![Pod Platform](http://img.shields.io/cocoapods/p/NetworkEye.svg?style=flat)](http://cocoadocs.org/docsets/NetworkEye/) 4 | [![Pod License](http://img.shields.io/cocoapods/l/NetworkEye.svg?style=flat)](https://opensource.org/licenses/MIT) 5 | 6 | [README English](https://github.com/coderyi/NetworkEye/blob/master/README.md) 7 | 8 | NetworkEye是一个网络调试库,可以监控App内HTTP请求并显示请求相关的详细信息,方便App开发的网络调试。 9 | 10 | 可以检测到包括网页,NSURLConnection,NSURLSession,AFNetworking,第三方库,第三方SDK等的HTTP请求,非常方便实用。并且可以统计App内流量 11 | 12 | NetworkEye,a iOS network debug library,It can monitor all HTTP requests within the App and displays all information related to the request. 13 | 14 | #### Podfile 15 | 16 | ```ruby 17 | platform :ios, '7.0' 18 | pod 'NetworkEye', '~> 1.0.1' 19 | ``` 20 | 21 | 22 | #### 使用 23 | 24 | 注意请在DEBUG模式下使用NetworkEye 25 | 在AppDelegate.m里面加入下面代码就可以了 26 |
27 | #import "NEHTTPEye.h"
28 | #if defined(DEBUG)||defined(_DEBUG)
29 |     [NEHTTPEye setEnabled:NO];
30 | #endif
31 | 
32 | 33 | 使用的时候可以通过双指轻拍或者摇一摇(Shake Gesture)手势调出监控数据界面NEHTTPEyeViewController 34 | 也可以用如下代码直接present出来。 35 |
36 | #if defined(DEBUG)||defined(_DEBUG)
37 |     NEHTTPEyeViewController *vc=[[NEHTTPEyeViewController alloc] init];
38 |     [self presentViewController:vc animated:YES completion:nil];
39 | #endif
40 | 
41 | 42 | 在NEHTTPEye.h里面有两个可以配置的参数即默认数据库密码是networkeye和默认监控最多300条请求,请求的保存位置在缓存目录的networkeye.sqlite内。 43 |
44 | #define kSQLitePassword @"networkeye"
45 | 
46 | #define kSaveRequestMaxCount 300
47 | 
48 | 49 | NetworkEye依赖仓库FMDB和SQLCipher。 50 | FMDB用于存储监控数据,SQLCipher用于加密数据库。 51 | 52 | 监控数据界面支持的搜索条件为URL,statusCode,HTTPMethod,MIMEType。 53 | 54 | NetworkEye的监控数据界面如图: 55 | 56 | 57 | 58 | 59 | 60 | 61 | --------------------------------------------------------------------------------