andysmart / timberjack Goto Github PK
View Code? Open in Web Editor NEWAutomatic network activity logger for iOS and OSX
License: MIT License
Automatic network activity logger for iOS and OSX
License: MIT License
We set custom header fields on the default session configuration which Timberjack removes
To reproduce create a manager in the following way:
class HTTPManager: Manager {
static let sharedManager: HTTPManager = {
let configuration = Timberjack.defaultSessionConfiguration()
let version = NSBundle.mainBundle().infoDictionary!["CFBundleVersion"] as! String
let release = NSBundle.mainBundle().infoDictionary!["CFBundleShortVersionString"] as! String
let device = UIDevice.currentDevice()
configuration.HTTPAdditionalHeaders = [
"User-Agent": "AppName iOS \(release)/\(version); \(device.systemName) \(device.systemVersion))",
"X-Device-Id": "Some generated ID"
]
let manager = HTTPManager(configuration: configuration)
return manager
}()
}
The received request looks like this:
POST /v1/event HTTP/1.1
Host: localhost:3000
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Connection: keep-alive
Accept: */*
User-Agent: AppName/54 CFNetwork/711.4.6 Darwin/15.4.0
Content-Length: 81
Accept-Language: en-us
Accept-Encoding: gzip, deflate
The expected header should look like this:
POST /v1/event HTTP/1.1
Host: localhost:3000
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Connection: keep-alive
X-Device-Id: Some generated ID
Accept: */*
User-Agent: AppName iOS 0.6.0/54; iPhone OS 8.4)
Content-Length: 81
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Dependency "Timberjack" has no shared framework schemes for any of the platforms: Mac
If you believe this to be an error, please file an issue with the maintainers at https://github.com/andysmart/Timberjack/issues/new
Note: Everything works fine otherwise when just including Timerjack.swift
As Swift 3 is out, a compatible version of EVURLCache would be nice.
For the moment I embed the lib in my project and convert it to Swift 3.
I'm having a problem integrating this with my custom Alamofire Manager. I currently construct the Manager like this:
private let manager = Alamofire.Manager(serverTrustPolicyManager: ServerTrustPolicyManager(policies: [
"api.example.com": .PerformDefaultEvaluation(validateHost: true),
"dev.api.example.com": .PerformDefaultEvaluation(validateHost: false),
"staging.api.example.com": .PerformDefaultEvaluation(validateHost: false)
]))
and my wildcard SSL certificate hostname verification is ignored on the dev.api and staging.api subdomains.
As soon as I add the configuration to support Timberjack logging to the Manager.init like this:
private let manager = Alamofire.Manager(configuration: Timberjack.defaultSessionConfiguration(), serverTrustPolicyManager: ServerTrustPolicyManager(policies: [
"api.example.com": .PerformDefaultEvaluation(validateHost: true),
"dev.api.example.com": .PerformDefaultEvaluation(validateHost: false),
"staging.api.example.com": .PerformDefaultEvaluation(validateHost: false)
]))
the default serverTrustPolicyManager seems to be used, and my SSL handshake with dev.api and staging.api fail, because they don't match the *.example.com SSL certificate hostname. It's like something is overwriting my ServerTrustPolicyManager.
Any ideas?
Which version of Timberjack I should include to my project? (Swift 3.2)
I set up version number 0.0.2, but actually when I build my project there are a lot of errors. How can solve this issue? Thanks.
I used your lib for days, after that it just stopped working, always getting error: No such Module 'Timberjack'. I even uninstalled Xcode 8 and cocapods together with my project, installed everything again and it's still not working. I love it, but just cannot make it work.
Do you have some clue what might be going on?
As title
I am not able to submit my app to app store. Getting following error:
Error 1:
ERROR ITMS-90171: "Invalid Bundle Structure - The binary file 'MyApp.app/Frameworks/Timberjack.framework/libswiftRemoteMirror.dylib' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles.
Error 2:
ERROR ITMS-90206: "Invalid Bundle. The bundle at 'MyApp.app/Frameworks/Timberjack.framework' contains disallowed file 'Frameworks'."
I have integrated Timberjack through Carthage.
Carthage: 0.24.0
Timberjack: 0.0.3
Xcode: 8.3.3
Right now Timberjack isn't handling the requirements for SSL pinning / validation (see #3).
It would be nice if this can be bundled in, or at least documented - while keeping things lightweight.
As title
I am seeing a crash (SIGSEGV - invalid memory address) in the following code when calling the Alamofire HTTPManager and passing the results of a call to the Timberjack.defaultSessionConfiguration():
class HTTPManager: Alamofire.SessionManager {
static let shared: HTTPManager = {
let configuration = Timberjack.defaultSessionConfiguration()
let manager = HTTPManager(configuration: configuration) . <=== Crashes here
return manager
}()
}
The is following the example in the Timberjack README file (https://github.com/andysmart/Timberjack)
And our network calls look like this:
class DataAgent: NSObject, NSCoding {
public static var manager:NetworkManager = NetworkManager()
let request:DataRequest = manager.networkRequest("(DataAgent.api_url)", method:NetworkingConstants.HTTPMethod.post, params: params)
request.validate()
.responseJSON { response in
switch response.result {
case .success(let data):
DataAgent.tokenCallback(json: JSON(data))
DataAgent.scope = role
print("Login Successful! (DataAgent.access_token ?? "UNDEFINED")")
completion(true)
case .failure(let error):
print("Login Failed: \(error)")
completion(false)
}
}
And the network request is in my NetworkManager class:
func networkRequest<T> (_ url:String, method:NetworkingConstants.HTTPMethod, params:[String : Any], mock:Bool = false) -> T {
...
let parameters:Parameters = params
let returnRequest:DataRequest = HTTPManager.shared.request(url, method: getAlamofireMethod(method), parameters: parameters)
return returnRequest as! T
...
}
But I am not able to reproduce this one on-demand but am seeing that my users are experiencing it.
It seems Cocoapods is serving the old tag (0.0.2). Would be great if it can be updated to the latest (0.0.3) with Swift3 compatibility. Thanks!
Is there any way to include the post body in the logged data?
Scheme isn't marked as shared, so carthage support is currently broken.
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.