kasketis / netfox Goto Github PK
View Code? Open in Web Editor NEWA lightweight, one line setup, iOS / OSX network debugging library! 🦊
License: MIT License
A lightweight, one line setup, iOS / OSX network debugging library! 🦊
License: MIT License
Would you mind if I added a Travis config to this repo? I'll configure it to build against Swift 3.2 and 4.0, to make sure we don't cause build issues for anybody again.
I've created a project where I having a large selection of debugging tools built into one debugging window. Netfox is spectacular, and I'd like to add it as another section of the pod. However I don't wish to present it modally, but rather push it onto my existing navigation controller. Is there any way we could publicly expose the NFXListController class for custom usage?
P.S. my library is in ObjC, so an @objc at the top would also be awesome!
Would love to see this update to Swift 3.0 to begin testing soon :)
Not sure what could be the reason for that... Any idea?
I see other requests (such ax Mixpanel and Facebook graph) but not Parse ones.
But beside it - great idea and really really great and cool implematation!
Thanks a lot!!
It's not catching requests/responses that go through Alamofire ("Equivalent" to AFNetworking in Swift)
Most basic case:
let request = ...
Alamofire.Manager.sharedInstance.request(request).validate().responseJSON() {
...
}
My guessing is that it's not working for any NSURLSession request, this is not working either:
let request = NSURLRequest(URL: url)
let task = NSURLSession.sharedSession().dataTaskWithRequest(request) { data, response, error in
Can we make a method to configure Netfox to ignore certain types of requests or url extensions?
I'm thinking about an app that loads many images, and we just want the main interaction between app <=> server and not those resources.
Please add Dissmiss Button, because i use shake gesture for other stuff
We are using a third party payment gateway. Some of the tasks (like entering credit card ) are done in a webview. When netfox was enabled website was not behaving properly (Mostly probably because javascript were not loaded properly).
I am not sure how to use this framework with an Objective C project? Should there be a bridging header included in the framework, or do I need to somehow create one in xCode?
Thanks.
Starting a first suggestion in #28 for OSX support, you seemed to be interested in it. Is there any work started yet? If no, would you be interested in a PR to handle it? (if I have the time to work on it...) Or just some helps?
We are really interested on this since we already using Netfox in our iOS application :)
Its not logging the request on xcode 7.2.1
This method is crashing, you should never unwrap variables without using 'guard' or 'if let' or define a default value
func configForObject(obj : NFXHTTPModel)
{
...
setStatus(obj.responseStatus!)
setTimeInterval(obj.timeInterval!)
setRequestTime(obj.requestTime!)
setType(obj.responseType!)
setMethod(obj.requestMethod!)
}
I propose not using them if they're not present and handle those cases, or simplest way:
setStatus(obj.responseStatus ?? 999)
setTimeInterval(obj.timeInterval ?? "-")
setRequestTime(obj.requestTime ?? "-")
setType(obj.responseType ?? "-")
setMethod(obj.requestMethod ?? "-")
You're the father, your call :D
It would be nice to have the ability to define our own method/gesture and call everything with one access method. Imagine this mixes up with shaking in some application, or we want to have a button always there to just display when the tester taps, etc.
Thanks!
why not support iOS7?
Hello, I think it'll be very useful to have an ability to use netfox with server with SSL pinning. Nowadays many apps avoid security issues, so they have pinning switched on connected server.
Any thoughts?
Hi,
I am using netfox in my project and I have been facing weird situation. After changing the account -which is logging out and signing in again- netfox UI does not show up both in simulator and device in debug mode. After shaking again, it closes my main.storyboard and opens up my login view controller which is in another storyboard. Maybe it does not have anything with netfox but I just wanted to ask you guys, I do not know how to figure out what causes this and you know maybe you can help. Any thougths?
Thank you for this library. Its helped a lot me. Quick way to check request and response.
I am trying to integrate human api (https://developer.humanapi.co), something wrong with Jawbone integration. I am not able to get few callbacks.
All requests that send data show as "Request body is empty" for the request body despite having the correct Content-Length set in the header
The reason is because when startLoading()
is called in NFXProtocol
the getNFXBody()
is nil
I believe this is the same issue as:
https://github.com/AliSoftware/OHHTTPStubs/wiki/Testing-for-the-request-body-in-your-stubs
I'm currently seeing if there's a different place to trap and save this data
I'm also using Alamofire but I'm not sure it's related to that
en, I think I don't know to design a logo,and I think NetworkEye need a logo
Netfox doesn't show any requests that was send with AFNetworking 2.6.1
My coworkers and myself LOVE Netfox. However the last commit was made 4 months ago. I'd love to support it, is there any way I may have write access?
Thanks!
This is REALLY useful for individual testing and debugging. It would be even better if when this is enabled it would post logs to a database periodically. Could be Dynamo, Elasticsearch, Mongo etc. This would allow broader profiling among Test and Beta users. Its important to understand your API consumption so you don't put out an app thats going to blow your API quota or violate a 3rd Party TOS and this could do that easily I think.
Are you using any private API's or anything that apple would find a reason to reject the app?
On the request details screen, request body is empty, but it filled in URLRequest.httpBody
Why do not you add a cocoapods or a Carthage?
That will make people more convenient to use
More of a mental note, but we should be using encryption in our storage of these request bodies, if we're not already.
I have an app which is doing somewhat large JSON imports very often in the background, like every 8-20s. The JSONs are parsed and saved into Core Data, all on the same backgorund thread/MOC.
With netfox compiled in, the memory usage became very large.
I was not aware of at first that netfox is the cause of this, so I was removing my background operations one my one until I was left with just one call. Without netfox, app would take 40-44MB. With netfox, it was 84MB. When I added another JSON call following the first one, without netfox memory usage was around 54MB, with netfox it was 150MB. This was all without netfox UI ever being triggered - it was just doing its thing in the background.
If it helps - both of these JSON calls cause reading/updating and creating a lot of NSManagedObjects from my Core Data store. This all happens in background MOC/thread, thus it's gone from memory as soon as it's processed. But if netfox is somehow keeping something from that thread retained, then it could be a reason that all of the objects from the thread are staying in memory.
My app is Objective-C based and I really don't know Swift thus can't help debugging this.
Still, though it's worth reporting this.
I was seeing some of my frameworks requests but I wasn't seeing them from my own app. I did some debugging and found that if your app uses a NSURLSessionConfiguration class and uses NSUrlSessionTasks, you must set the protocol class yourself.
Also, in NFXProtocol, you must implement the following method.
override public class func canInitWithTask(task: NSURLSessionTask) -> Bool {
if !NFX.sharedInstance().isEnabled() {
return false
}
if let url = task.currentRequest?.URL {
if (!(url.absoluteString.hasPrefix("http")) && !(url.absoluteString.hasPrefix("https"))) {
return false
}
for ignoredURL in NFX.sharedInstance().getIgnoredURLs() {
if url.absoluteString.hasPrefix(ignoredURL) {
return false
}
}
} else {
return false
}
if NSURLProtocol.propertyForKey("NFXInternal", inRequest: task.currentRequest!) != nil {
return false
}
return true
}
I will try to get around to making a pull request, but I wanted to post this in case other people weren't seeing all of their traffic.
When creating a custom manager to work with Alamofire:
static let sharedManager: TIFAlamofireManager = {
let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
configuration.protocolClasses?.insert(NFXProtocol.self, atIndex: 0)
configuration.HTTPAdditionalHeaders = Manager.defaultHTTPHeaders
let manager = TIFAlamofireManager(configuration: configuration)
manager.startRequestsImmediately = false
return manager
}()
The caching of URLRequests seems to be broken.
After disabling this line:
configuration.protocolClasses?.insert(NFXProtocol.self, atIndex: 0)
Caching works as expected.
Anyone else encountering this issue?
In NFXHTTPModel.swift, func prettyPrint (line 239)
return NSString(data: prettyPrintedString, encoding: String.Encoding.utf8.rawValue) as? String
should be
return NSString(data: prettyPrintedString, encoding: String.Encoding.utf8.rawValue) as String?
I'm trying to use this with Carthage, but it doesn't work for me. I'm only building for iOS with:
carthage build --platform iOS
The issue is that the framework is defined as netfox_ios instead of netfox (and the same for the module name). Is there any way to make the framework and module name be "netfox" as with Cocoapods?
Hi,
Very good work.
Could you please share your schema to support carthage installation?
https://github.com/Carthage/Carthage/blob/master/README.md#supporting-carthage-for-your-framework
THX
Even with the latest changes to Netfox, there still remains a rare crash in NFXProtocol's startLoading(), during client.URLProtocolDidFinishLoading(self).
EXC_BREAKPOINT (code=1, subcode=0x1815e97d0)
Call stack of crash:
Thread 10Queue : NSOperationQueue 0x12effa0a0 :: NSOperation 0x1300bf730 (QOS: LEGACY) (serial)
#0 0x00000001815e97d0 in _os_lock_corruption_abort ()
#1 0x00000001815e97d0 in _OSSpinLockLockSlow$VARIANT$wfe ()
#2 0x0000000181f7b570 in CFURLProtocol_NS::forgetProtocolClient() ()
#3 0x000000010019f038 in NFXProtocol.(startLoading() -> ()).(closure #1) at .../netfox/netfox/NFXProtocol.swift:89
It appears others doing NSURLProtocol work have this exact same crash. See this: https://forums.developer.apple.com/thread/26081
And see the threading rules mentioned in that discussion thread here: https://developer.apple.com/library/ios/samplecode/CustomHTTPProtocol/Listings/Read_Me_About_CustomHTTPProtocol_txt.html
Maybe someone with more experience with Netfox's code can research and fix this? I receive reports of this crash routinely via Crashlytics, and I just hit it again in a local build I was debugging today upon launch of my app, which is using current root source of netfox (6/15/16).
The crash is really easy to reproduce: always happening!
I've noticed that this is the only framework that I use that has the framework name lowercased. @kasketis - Was this intentional? Do you mind if we update it to Netfox instead of netfox?
As mentioned in the help docs, users have to manually write:
if let bodyData = mutableURLRequest.HTTPBody {
NSURLProtocol.setProperty(bodyData, forKey: "NFXBodyData", inRequest: mutableURLRequest)
}
It would be spectacular if there was a way to do this internally using swizzling
I know netfox works base on NSURLProtocol. So the question is Is there any way to make a request without using NSURLProtocol ?
Awesome little library! I wonder, though -- why is NFXProtocol internal? When importing this as a pod, I'm unable to create a custom NFXManager to support Alamofire.
Hi,
My app uses websocket, it doesn't seem to be logged.
Hello folks,
I'm searching for new cool things to add in the next releases of netfox!
Please contribute your ideas here! :)
Moya uses Alamofire to make request but I couldn't figure out how I can embed NFXManager for Alamofire. Any suggestion?
Pretty printing request responses could be a very nice enhancement! Nice work, thank you.
Great tool!
Would you expect this to work with https://github.com/kiavashfaisali/KFSwiftImageLoader ?
I'm able to see other request/responses in netfox, except for those...
Hi,
I am integrating netfox manually (by dragging the swift files folder in xcode). Xcode compiling it fine, but problem is how i can import them in my objective-c project. i even tried with this statement
but it didn't worked for me and xcode is giving error that file not found. I am in middle of it please help.
Thanks.
It seems the developer for this project has gone AWOL. Does anyone have an alternative? Or has someone taken over active development on a fork somewhere?
Is it possible to format long responses (the view that just shows all the response when it's too big to fit) with the prettyPrint option?
I saw that's a textfield and it's just loading a plain string.
Please update pod spec to 2.1 version
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.