Giter Club home page Giter Club logo

responsedetective's Introduction

ResponseDetective is a non-intrusive framework for intercepting any outgoing requests and incoming responses between your app and your server for debugging purposes.

Requirements

ResponseDetective is written in Swift 5.3 and supports iOS 9.0+, macOS 10.10+ and tvOS 9.0+.

Usage

Incorporating ResponseDetective in your project is very simple – it all comes down to just two steps:

Step 1: Enable interception

For ResponseDetective to work, it needs to be added as a middleman between your (NS)URLSession and the Internet. You can do this by registering the provided URLProtocol class in your session's (NS)URLSessionConfiguration.protocolClasses, or use a shortcut method:

// Objective-C

NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
[RDTResponseDetective enableInConfiguration:configuration];
// Swift

let configuration = URLSessionConfiguration.default
ResponseDetective.enable(inConfiguration: configuration)

Then, you should use that configuration with your (NS)URLSession:

// Objective-C

NSURLSession *session = [[NSURLSession alloc] initWithConfiguration:configuration];
// Swift

let session = URLSession(configuration: configuration)

Or, if you're using AFNetworking/Alamofire as your networking framework, integrating ResponseDetective comes down to just initializing your AFURLSessionManager/Manager with the above (NS)URLSessionConfiguration:

// Objective-C (AFNetworking)

AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
// Swift (Alamofire)

let manager = Alamofire.SessionManager(configuration: configuration)

And that's all!

Step 2: Profit

Now it's time to perform the actual request:

// Objective-C

NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://httpbin.org/get"]];
[[session dataTaskWithRequest:request] resume];
// Swift

let request = URLRequest(URL: URL(string: "http://httpbin.org/get")!)
session.dataTask(with: request).resume()

VoilΓ ! πŸŽ‰ Check out your console output:

<0x000000000badf00d> [REQUEST] GET https://httpbin.org/get
 β”œβ”€ Headers
 β”œβ”€ Body
 β”‚ <none>

<0x000000000badf00d> [RESPONSE] 200 (NO ERROR) https://httpbin.org/get
 β”œβ”€ Headers
 β”‚ Server: nginx
 β”‚ Date: Thu, 01 Jan 1970 00:00:00 GMT
 β”‚ Content-Type: application/json
 β”œβ”€ Body
 β”‚ {
 β”‚   "args" : {
 β”‚   },
 β”‚   "headers" : {
 β”‚     "User-Agent" : "ResponseDetective\/1 CFNetwork\/758.3.15 Darwin\/15.4.0",
 β”‚     "Accept-Encoding" : "gzip, deflate",
 β”‚     "Host" : "httpbin.org",
 β”‚     "Accept-Language" : "en-us",
 β”‚     "Accept" : "*\/*"
 β”‚   },
 β”‚   "url" : "https:\/\/httpbin.org\/get"
 β”‚ }

Installation

Carthage

If you're using Carthage, add the following dependency to your Cartfile:

github "netguru/ResponseDetective" ~> {version}

CocoaPods

If you're using CocoaPods, add the following dependency to your Podfile:

use_frameworks!
pod 'ResponseDetective', '~> {version}'

Swift Package Manager

If you're using Swift Package Manager, add this repository to the Swift Packages in your project settings.

Local

To install the test dependencies or to build ResponseDetective itself, do not run carthage directly. It can't handle the Apple Silicon architectures introduced in Xcode 12. Instead, run it through the carthage.sh script:

$ ./carthage.sh bootstrap

Alternatively, you can run the tests locally using Swift Package Manager with the following command:

$ swift test

About

This project was made with β™‘ by Netguru.

Release names

Starting from version 1.0.0, ResponseDetective's releases are named after Sherlock Holmes canon stories, in chronological order. What happens if we reach 60 releases and there are no more stories? We don't know, maybe we'll start naming them after cats or something.

License

This project is licensed under MIT License. See LICENSE.md for more info.

responsedetective's People

Contributors

akashivskyy avatar castus avatar damianmarkowski avatar mattboran avatar minashehata avatar serejahh avatar siemian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

responsedetective's Issues

Crash on iOS 13.4 (EXC_BAD_ACCESS)

What happened:
The library has started crashing after updating to iOS 13.4 both simulator and device.

com.apple.CFNetwork.CustomProtocols (119): EXC_BAD_ACCESS (code=EXC_i386_GPFLT)

Where:
URLProtocol.swift line 43

Environment:
MacOS 10.15.4
Xcode 11.4
iOS 13.4
ResponseDetective 1.3.0
CocoaPods 1.9.1

Screen Shot 2020-03-25 at 18 36 10

Push version 1.4.0 to CocoaPods

I just released version 1.4.0, it needs to be pushed to CocoaPods trunk. Seems I have lost my powers to do this myself. πŸ˜‰

This only needs a pod trunk push from master. Everything else is ready. Alternatively, you can add me to the ResponseDetective's trunk as collaborator (you should have my email).

Not compatible with Swift 4.1 on Xcode 9.3 targeting iOS 11.3

/foobar/app/Carthage/Checkouts/ResponseDetective/ResponseDetective/Sources/RDTXMLBodyDeserializer.m:18:23: error: implicit declaration of function 'xmlReadMemory' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        xmlDocPtr document = xmlReadMemory(memory, ((int)(strlen(memory))), NULL, NULL, XML_PARSE_NOCDATA | XML_PARSE_NOBLANKS);
                             ^
/foobar/app/Carthage/Checkouts/ResponseDetective/ResponseDetective/Sources/RDTXMLBodyDeserializer.m:18:23: error: declaration of 'xmlReadMemory' must be imported from module 'libxml2.parser' before it is required
In module 'libxml2' imported from /foobar/app/Carthage/Checkouts/ResponseDetective/ResponseDetective/Sources/RDTXMLBodyDeserializer.m:8:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/usr/include/libxml2/libxml/parser.h:1138:3: note:
previous declaration is here
                xmlReadMemory           (const char *buffer,
                ^
/foobar/app/Carthage/Checkouts/ResponseDetective/ResponseDetective/Sources/RDTXMLBodyDeserializer.m:18:23: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
        xmlDocPtr document = xmlReadMemory(memory, ((int)(strlen(memory))), NULL, NULL, XML_PARSE_NOCDATA | XML_PARSE_NOBLANKS);
                             ^
/foobar/app/Carthage/Checkouts/ResponseDetective/ResponseDetective/Sources/RDTXMLBodyDeserializer.m:18:23: error: conflicting types for 'xmlReadMemory'
In module 'libxml2' imported from /foobar/app/Carthage/Checkouts/ResponseDetective/ResponseDetective/Sources/RDTXMLBodyDeserializer.m:8:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/usr/include/libxml2/libxml/parser.h:1138:3: note:
previous declaration is here
                xmlReadMemory           (const char *buffer,
                ^
/foobar/app/Carthage/Checkouts/ResponseDetective/ResponseDetective/Sources/RDTXMLBodyDeserializer.m:18:82: error: declaration of 'XML_PARSE_NOCDATA' must be imported from module 'libxml2.parser' before it is required
        xmlDocPtr document = xmlReadMemory(memory, ((int)(strlen(memory))), NULL, NULL, XML_PARSE_NOCDATA | XML_PARSE_NOBLANKS);
                                                                                        ^
In module 'libxml2' imported from /foobar/app/Carthage/Checkouts/ResponseDetective/ResponseDetective/Sources/RDTXMLBodyDeserializer.m:8:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/usr/include/libxml2/libxml/parser.h:1104:5: note:
previous declaration is here
    XML_PARSE_NOCDATA   = 1<<14,/* merge CDATA as text nodes */
    ^
/foobar/app/Carthage/Checkouts/ResponseDetective/ResponseDetective/Sources/RDTXMLBodyDeserializer.m:18:102: error: use of undeclared identifier 'XML_PARSE_NOBLANKS'
        xmlDocPtr document = xmlReadMemory(memory, ((int)(strlen(memory))), NULL, NULL, XML_PARSE_NOCDATA | XML_PARSE_NOBLANKS);
                                                                                                            ^
6 errors generated.

Improve printing of empty, unrecognizable and non-raw bodies

Currently ResponseDetective prints <none> for bodies in the following situations:

  1. when the body is empty, i.e. has 0 bytes;
  2. and when the body cannot be deserialized, i.e. has an unsupported content-type.

The 2nd situation might be confusing as <none> might suggest that a request has an empty body.

The proposal is to improve handling of empty and non-deserializable bodies in the following way:

  1. for empty bodies β†’ print <empty>;
  2. for non-deserializable bodies β†’ print <unrecognizable x bytes>.

In addition, other non-raw bodies, such as 1px Γ— 1px image for image/* content-type, should also be wrapped in triangular brackets (i.e. <1px Γ— 1px image>) so that it can be distinguished from plain text bodies with similar contents.

Can't import ResponseDetective

I tried playing around with your library, I installed it with cocoapods I couldn't import it, tried your playground got No such module... error, tried it on another machine same thing.
my xcode version 8.0, second machine xcode version 8.2

Swift 2 Support

Could you create a Swift 2 branch with instructions on how to install that branch via cocoa pods like alamofire has?

Project broken

I add your library by use CocoaPods.
It have a lot of errors and Xcode 8 cannot compile it.
Looks like it done on Swift 2 not on Swift 3 like it pretend to be.

Add response filtering method.

Currently there is a method available to filter logged requests:
ignoreRequests(matchingPredicate predicate: NSPredicate)

The goal here is to create a method with the same idea to filter responses that are logged into console.

Motivation - I've integrated the library into the app and instantly deintegrated it due to amount of logged stuff that became totally unreadable. Single logs are really useful and readable, but I want to filter only responses that failed for some reason to investigate possible bugs.

Support for multipart/form-data requests

ResponseDetective should support multipart/form-data requests, deserializing each data segment as if they were at the root level.

The output of body section should provide information on all segments:

Segment 0
 β”œβ”€ Headers
 β”‚ Content-Type: image/png
 β”‚ Content-Disposition: form-data; name="foo"; filename="image.png"
 β”œβ”€ Body
 β”‚ 10px Γ— 10px image

Segment 1
 β”œβ”€ Headers
 β”‚ Content-Disposition: form-data; name="bar"
 β”œβ”€ Body
 β”‚ baz

Segment 2
 β”œβ”€ Headers
 β”‚ Content-Type: application/octet-stream
 β”‚ Content-Disposition: form-data; name="qux"
 β”œβ”€ Body
 β”‚ <none>

Crashing on iOS 10.3.1

The app is crashing without any message on iOS 10.3.1.
Upon rebuilding the 'ResponseDetective' using Carthage update --platform ios it is giving following error:

:0: warning: argument unused during compilation: '-iapinotes-modules /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64

Trace/BPT trap:5 error since XCode 13.3

Hello, since updating XCode to 13.3 I have the following Trace/BPT trap: 5 error during build. I am using cocoapods. Has someone some ideas about how to get around this ?

CompileSwift normal x86_64 (in target 'ResponseDetective' from project 'Pods')
    cd /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/BufferOutputFacility.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/ConsoleOutputFacility.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/Dictionary.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/ErrorRepresentation.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/ImageBodyDeserializer.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/JSONBodyDeserializer.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/OutputFacility.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/PlaintextBodyDeserializer.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/RequestRepresentation.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/ResponseDetective.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/ResponseRepresentation.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/URLEncodedBodyDeserializer.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/URLProtocol.swift -supplementary-output-file-map /var/folders/fq/s0bj6lr95t5_lvx66lqyv0cw0000gn/T/TemporaryDirectory.JREny4/supplementaryOutputs-1 -target x86_64-apple-ios8.0-simulator -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.4.sdk -I /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Products/Debug-dev-iphonesimulator/ResponseDetective -F /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Products/Debug-dev-iphonesimulator/ResponseDetective -suppress-warnings -g -import-underlying-module -module-cache-path /Users/williamsantos/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -profile-generate -profile-coverage-mapping -swift-version 5 -enforce-exclusivity\=checked -O -D COCOAPODS -new-driver-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -serialize-debugging-options -Xcc -working-directory -Xcc /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -Xcc -I/Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/ResponseDetective-generated-files.hmap -Xcc -I/Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/ResponseDetective-own-target-headers.hmap -Xcc -I/Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/ResponseDetective-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/ResponseDetective-project-headers.hmap -Xcc -I/Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Products/Debug-dev-iphonesimulator/ResponseDetective/include -Xcc -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.4.sdk/usr/include/libxml2 -Xcc -I/Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/DerivedSources-normal/x86_64 -Xcc -I/Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/DerivedSources/x86_64 -Xcc -I/Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/DerivedSources -Xcc -DPOD_CONFIGURATION_DEBUG_DEV\=1 -Xcc -DCOCOAPODS\=1 -Xcc -ivfsoverlay -Xcc /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/unextended-module-overlay.yaml -module-name ResponseDetective -target-sdk-version 15.4 -num-threads 8 -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/BufferOutputFacility.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/ConsoleOutputFacility.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/Dictionary.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/ErrorRepresentation.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/ImageBodyDeserializer.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/JSONBodyDeserializer.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/OutputFacility.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/PlaintextBodyDeserializer.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/RequestRepresentation.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/ResponseDetective.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/ResponseRepresentation.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/URLEncodedBodyDeserializer.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/URLProtocol.o

[cleanup]   %17 = apply %15(%16) : $@convention(method) (@guaranteed String) -> @owned NSString
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0.	Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/BufferOutputFacility.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/ConsoleOutputFacility.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/Dictionary.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/ErrorRepresentation.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/ImageBodyDeserializer.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/JSONBodyDeserializer.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/OutputFacility.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/PlaintextBodyDeserializer.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/RequestRepresentation.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/ResponseDetective.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/ResponseRepresentation.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/URLEncodedBodyDeserializer.swift /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/URLProtocol.swift -supplementary-output-file-map /var/folders/fq/s0bj6lr95t5_lvx66lqyv0cw0000gn/T/TemporaryDirectory.JREny4/supplementaryOutputs-1 -target x86_64-apple-ios8.0-simulator -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.4.sdk -I /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Products/Debug-dev-iphonesimulator/ResponseDetective -F /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Products/Debug-dev-iphonesimulator/ResponseDetective -suppress-warnings -g -import-underlying-module -module-cache-path /Users/williamsantos/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -profile-generate -profile-coverage-mapping -swift-version 5 -enforce-exclusivity=checked -O -D COCOAPODS -new-driver-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -serialize-debugging-options -Xcc -working-directory -Xcc /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -Xcc -I/Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/ResponseDetective-generated-files.hmap -Xcc -I/Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/ResponseDetective-own-target-headers.hmap -Xcc -I/Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/ResponseDetective-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/ResponseDetective-project-headers.hmap -Xcc -I/Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Products/Debug-dev-iphonesimulator/ResponseDetective/include -Xcc -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.4.sdk/usr/include/libxml2 -Xcc -I/Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/DerivedSources-normal/x86_64 -Xcc -I/Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/DerivedSources/x86_64 -Xcc -I/Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/DerivedSources -Xcc -DPOD_CONFIGURATION_DEBUG_DEV=1 -Xcc -DCOCOAPODS=1 -Xcc -ivfsoverlay -Xcc /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/unextended-module-overlay.yaml -module-name ResponseDetective -target-sdk-version 15.4 -num-threads 8 -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/BufferOutputFacility.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/ConsoleOutputFacility.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/Dictionary.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/ErrorRepresentation.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/ImageBodyDeserializer.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/JSONBodyDeserializer.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/OutputFacility.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/PlaintextBodyDeserializer.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/RequestRepresentation.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/ResponseDetective.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/ResponseRepresentation.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/URLEncodedBodyDeserializer.o -o /Users/williamsantos/Library/Developer/Xcode/DerivedData/rgplayers-diegoaqfaikdhufogwsifirnsral/Build/Intermediates.noindex/Pods.build/Debug-dev-iphonesimulator/ResponseDetective.build/Objects-normal/x86_64/URLProtocol.o
1.	Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)
2.	Compiling with the current language version
3.	While evaluating request ASTLoweringRequest(Lowering AST to SIL for module ResponseDetective)
4.	While silgen emitFunction SIL function "@$s17ResponseDetective21ConsoleOutputFacilityC14printBoxString33_174F18FF5D8597AF4BD2C57144D28C7ELL5title8sectionsySS_SaySS_SaySSGtGtF".
 for 'printBoxString(title:sections:)' (at /Users/williamsantos/Documents/workspace_ios/app-players-ios/Pods/ResponseDetective/ResponseDetective/Sources/ConsoleOutputFacility.swift:141:10)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x0000000106da6f88 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x0000000106da5f9c llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x0000000106da7618 SignalHandler(int) + 344
3  libsystem_platform.dylib 0x00000001931144e4 _sigtramp + 56
4  swift-frontend           0x0000000102d45264 (anonymous namespace)::Transform::transform(swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, swift::SILType, swift::Lowering::SGFContext) + 10344
5  swift-frontend           0x0000000102cb213c emitNativeToCBridgedValue(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::CanType, swift::CanType, swift::SILType, swift::Lowering::SGFContext) + 6260
6  swift-frontend           0x0000000102cd73e0 swift::Lowering::Conversion::emit(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::SGFContext) const + 760
7  swift-frontend           0x0000000102cd800c swift::Lowering::ConvertingInitialization::copyOrInitValueInto(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, bool) + 132
8  swift-frontend           0x0000000102c7af40 (anonymous namespace)::ScalarResultPlan::finish(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::CanType, llvm::ArrayRef<swift::Lowering::ManagedValue>&, swift::SILValue) + 460
9  swift-frontend           0x0000000102c91d88 swift::Lowering::SILGenFunction::emitApply(std::__1::unique_ptr<swift::Lowering::ResultPlan, std::__1::default_delete<swift::Lowering::ResultPlan> >&&, swift::Lowering::ArgumentScope&&, swift::SILLocation, swift::Lowering::ManagedValue, swift::SubstitutionMap, llvm::ArrayRef<swift::Lowering::ManagedValue>, swift::Lowering::CalleeTypeInfo const&, swift::OptionSet<swift::ApplyFlags, unsigned char>, swift::Lowering::SGFContext, llvm::Optional<swift::ImplicitActorHopTarget>) + 2160
10 swift-frontend           0x0000000102c982fc (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 2464
11 swift-frontend           0x0000000102c95dc0 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2160
12 swift-frontend           0x0000000102cefc88 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 40
13 swift-frontend           0x0000000102cd6ff0 swift::Lowering::SILGenFunction::emitConvertedRValue(swift::SILLocation, swift::Lowering::Conversion const&, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext)>) + 312
14 swift-frontend           0x0000000102ca4ff0 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 3080
15 swift-frontend           0x0000000102c9360c (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 200
16 swift-frontend           0x0000000102cad348 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, swift::ForeignInfo const&) && + 524
17 swift-frontend           0x0000000102cace94 (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, swift::ForeignInfo const&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&) + 932
18 swift-frontend           0x0000000102c9823c (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 2272
19 swift-frontend           0x0000000102c95dc0 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2160
20 swift-frontend           0x0000000102ceff94 swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 624
21 swift-frontend           0x0000000102d5805c swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 3676
22 swift-frontend           0x0000000102d125e0 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 704
23 swift-frontend           0x0000000102c86940 swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 10084
24 swift-frontend           0x0000000102c88be8 emitOrDelayFunction(swift::Lowering::SILGenModule&, swift::SILDeclRef, bool) + 228
25 swift-frontend           0x0000000102c841c8 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 228
26 swift-frontend           0x0000000102d666ac (anonymous namespace)::SILGenType::emitType() + 296
27 swift-frontend           0x0000000102c8c99c swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 104
28 swift-frontend           0x0000000102c8b3e4 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 3396
29 swift-frontend           0x0000000102d56e74 swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> > (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 216
30 swift-frontend           0x0000000102c8e8c8 llvm::Expected<swift::ASTLoweringRequest::OutputType> swift::Evaluator::getResultUncached<swift::ASTLoweringRequest>(swift::ASTLoweringRequest const&) + 608
31 swift-frontend           0x0000000102648d8c swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6700
32 swift-frontend           0x0000000102610130 swift::mainEntry(int, char const**) + 808
33 dyld                     0x00000001096210f4 start + 520
error: Trace/BPT trap: 5 (in target 'ResponseDetective' from project 'Pods')

Unsupported on Carthage 0.26.2

On Carthage 0.26.2 on bootstrap there is exit code 66. In logs there is informationxcodebuild: error: Scheme iOS is not currently configured for the archive action.

Reimplement interception by using swizzling instead of URLProtocol

Using a custom URLProtocol subclass to intercept HTTP(S) traffic surely results in being a good citizen, but, as a way to debug apps, it comes with disadvantages:

  1. First of all, the architecture of URLProtocol requires the subclasses to operate on static levels, essentially making them singletons. This has an implication that only one interception mechanism can exist at a time, even when using multiple URLSessions.

  2. Using URLProtocol that internally uses another URLSession prevents users of ResponseDetective from using their custom URLSession subclasses or even URLSessionDelegates. Since URLProtocol doesn't have access to the custom delegates, issues line #2 emerge.

The alternative to using a custom URLProtocol is to use swizzling to create a trampoline of URLSessionDelegate that would have the following advantages:

  1. There can be multiple instances of interceptors, one per each URLSession instance. This makes them more configurable and even more testable. This resolves the first problem of URLProtocol.

  2. Since the trampoline of URLSessionDelegate would bounce back to the "original" delegate set by user, users will still be able to customize the behavior of URLSession directly (even by subclassing it). This resolves the second problem of URLProtocol and #2.

  3. Swizzling doesn't require users to pass custom URLSessionConfigurations to URLSessions during initialization, which enables them to inject ResponseDetective at any time to any existing instance of URLSession.

  4. Swizzling can optionally be done globally during application launch, which would enable users to inject ResponseDetective to URLSession instances they do not own. This would enable them to debug traffic in third-party dependencies.

As seen above, using swizzling may eventually be a better, more customizable and safer implementation of ResponseDetective.

Hide Objective-C nature of XML and HTML body deserializers

As libxml cannot be imported to Swift directly, ResponseDetective currently uses RDTBodyDeserializer, RDTXMLBodyDeserializer and RDTHTMLBodyDeserializer types, thus making its unwanted Objective-C nature public.

Ideally, I'd like to remove all traces of Objective-C files from the project. This could be achieved in a couple of ways:

  1. Use an Objective-C libxml wrapper as an external framework and import it directly in Swift. This is the worst solution because it adds an unwanted third-party dependency to ResponseDetective.

  2. Create a project-private libxml wrapper as a separate framework and import it directly in Swift. This is better than the 1st solution, but adds a lot of unwanted complexity, especially with header search paths, linking and module maps.

  3. Use a project-private module (not to be mistaken with framework) that exposes needed libxml functionalities internally to ResponseDetective, but no further. This is the best solution.

Assuming the 3rd solution is chosen, the proposed implementation would consist of the following files:

  • A .m file that uses libxml and contains implementation of XML and HTML pretty-printing,
  • A non-public .h file that contains interface of above implementation,
  • A .modulemap file that defines a module including the above header.

As a result, ResponseDetective could import XMLPrettyPrinting (exemplary name of module) directly and use refined-for-Swift APIs without them leaking to the outside world.

Using from Obj-C

The generated ResponseDetective-Swift.h header file only exposes the class InterceptingProtocol and its methods +unregisterAllRequestInterceptors, +unregisterAllResponseInterceptors, +unregisterAllErrorInterceptors in addition to the NSURLProtocol and delegate methods.

There is therefore no way to register any interceptors, nor get at their classes.

Edit: This is from the 0.2 downloaded framework

All requests made with Alamofire manager cancelled after adding InterceptingProtocol

After I've added ResponseDetective to my project and assigned InterceptingProtocol to protocol classes of configuration used to create Alamofire manager

configuration.protocolClasses = [InterceptingProtocol.self]
manager = Alamofire.Manager(configuration: configuration)

all my requests are canceled.

ResponseDetective prints requests and responses correctly, but Alamofire manager response callback is always called with the following error:

Optional(Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo=0x7f9683068010 {NSErrorFailingURLKey=http://private-c73ea-roommatev2.apiary-mock.com/sessions, NSLocalizedDescription=cancelled, NSErrorFailingURLStringKey=http://private-c73ea-roommatev2.apiary-mock.com/sessions})

Does not work with skipped certificate validation

I have to use server with invalid SSL certificate for development. So I set up Alamofire manager to skipping SSL verification with this code (applicable for NSURLSession too):

manager.delegate.sessionDidReceiveChallenge = { session, challenge in
    if challenge.protectionSpace.authenticationMethod == "NSURLAuthenticationMethodServerTrust" {
        return (.UseCredential, NSURLCredential(forTrust: challenge.protectionSpace.serverTrust))
    }

    return (.PerformDefaultHandling, nil)
}

When I try to use your library with this setup, communication is interrupted and this line is printed out:

NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9814)

So is possible to use your library with skipped certificate verification?

Runtime crash

Hello guys,

After I updated Xcode to 11.4 I got this exception on start.

	/// A unique identifier of the request. Currently its address.
private lazy var requestIdentifier: String = String(describing: Unmanaged<AnyObject>.passUnretained(self.internalTask.originalRequest! as AnyObject).toOpaque())

com.apple.CFNetwork.CustomProtocols (12): EXC_BAD_ACCESS (code=EXC_I386_GPFLT)

Screen Shot 2020-04-05 at 23 03 29

Best regards,
Konstantin

Error while building the project

ld: /Users/user_name/Library/Developer/Xcode/DerivedData/Project_Name-gblnftdcyqwoicfexphoypuxrrfl/Build/Products/Debug-iphonesimulator/ResponseDetective/ResponseDetective.framework/ResponseDetective compiled with older version of Swift language (2.0) than previous files (3.0) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

XCode 8 Beta 3

I've enabled the "Use Legacy Swift Version" to 'yes' but still getting this error.

Some Requests are getting cancelled when Response Detective is enabled

I am using a POST network call which does get cancelled for some unknown reason.

When i am not enabling responseDetective, i do get a response with code 200.

I am using pure URLSession. Not using any external libraries for the request.

When responseDetective is active the request is getting cancelled and on console log i do see:

 [Info] (NetworkLogger, output(requestRepresentation:), 23): [Network] Request id EFF99D2A-7E69-414D-B6C9-9C1D993D4BAD (POST) api/v0/somePath/other
 API MISUSE: NSURLSession delegate RDTURLProtocol: <RDTURLProtocol: 0x6000019f2c10> (0x6000019f2c10)
 API MISUSE: task:willPerformHTTPRedirection:newRequest:completionHandler: completion handler not called
 [Error] (NetworkLogger, output(errorRepresentation:), 47): [Network] Error id EFF99D2A-7E69-414D-B6C9-9C1D993D4BAD domain: NSURLErrorDomain code: -999 reason: cancelado
[Info] (NetworkLogger, output(requestRepresentation:), 23): [Network] Request id 82292D2C-05B7-4950-AC17-9B88516ABA1F (POST) api/v0/somePath/other/xxxxx

umbrella header not found for static library

I'm not quite sure, if this issue is related to ResponseDetective or CocoaPods. See related Issue at CocoaPods here.

Report

What did you do?

pod install

Moved ResponseDetective.h to Public in Header Build Phase of ResponseDetective Target stackoverflow

set -o pipefail && xcodebuild -workspace ./staticLibrariesTest.xcworkspace -scheme staticLibrariesTest -destination 'generic/platform=iOS' -archivePath /Users/stephanlerner/Library/Developer/Xcode/Archives/2018-05-30/staticLibrariesTest\ 2018-05-30\ 12.19.17.xcarchive archive | tee /Users/stephanlerner/Library/Logs/gym/staticLibrariesTest-staticLibrariesTest.log | xcpretty

What did you expect to happen?

Succeeding build, since project builds fine in Xcode itself.

What happened instead?

bildschirmfoto 2018-05-30 um 12 39 43

CocoaPods Environment

Stack

   CocoaPods : 1.5.3
        Ruby : ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin17]
    RubyGems : 2.6.14
        Host : Mac OS X 10.13.4 (17E202)
       Xcode : 9.3.1 (9E501)
         Git : git version 2.15.1 (Apple Git-101)
Ruby lib dir : /Users/stephanlerner/.rvm/rubies/ruby-2.4.1/lib
Repositories : accengage - https://github.com/Accengage/ios-pod-specs.git @ d460bd659b14a17647ac91f0d1883f5adf971fa6
               bitbucket-alpodspecs - [email protected]:lb-lab/alpodspecs.git @ 64255e8d818a9f2456cecba94eb8b6f00d71d9dc
               bitbucket-alpodspecs-1 - ssh://[email protected]/lb-lab/alpodspecs.git @ 64255e8d818a9f2456cecba94eb8b6f00d71d9dc
               bitbucket-lb-lab-alpodspecs - https://bitbucket.org/lb-lab/alpodspecs @ 64255e8d818a9f2456cecba94eb8b6f00d71d9dc
               bitbucket-lb-lab-aplprogresskringel - https://bitbucket.org/lb-lab/aplprogresskringel @ f1475980ce47de9f020c53906207382299cfbe46
               master - https://github.com/CocoaPods/Specs.git @ 95c1a9cfce9808cd373c99eb16479bad45ecaac2

Installation Source

Executable Path: /Users/stephanlerner/.rvm/gems/ruby-2.4.1/bin/pod

Plugins

cocoapods-deintegrate : 1.0.2
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.3.0
cocoapods-try         : 1.1.0

Podfile

# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'

target 'staticLibrariesTest' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks

  # Pods for staticLibrariesTest

  pod 'ResponseDetective'

  target 'staticLibrariesTestTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'staticLibrariesTestUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

Project that demonstrates the issue

https://github.com/apploft/staticLibrariesTest

Issue when using ResponseDetective with Carthage

Hello! We are having this issue since yesterday when trying to use the project through Carthage:

A shell task (/usr/bin/env git clone --bare --quiet https://github.com/netguru/xcconfigs.git /Users/adrian/Library/Caches/org.carthage.CarthageKit/dependencies/xcconfigs) failed with exit code 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled

Any chance that the access rights for the repo https://github.com/netguru/xcconfigs.git changed?

Request Body is always <none>

I've setup ResponseDetective with Alamofire and it works great for responses. But the body of my requests in the console always shows as <none>, even when I am including parameters with the request.

 β”œβ”€ Headers
 β”‚ Content-Type: application/x-www-form-urlencoded; charset=utf-8
 β”‚ Content-Length: 18
 β”œβ”€ Body
 β”‚ <none>

Is there a way to have it include the request parameters in the console log?

Content-Type headers with parameters are not honored

Per RFC 7231, Content-Type HTTP header is defined as a media type that may contain additional properties, such as:

Content-Type: application/json; charset=utf-8

Currently, ResponseDetective does not honor such values and therefore fails to find a deserializer for them, resulting in empty bodies (#23).

Carthage *** Skipped installing ResponseDetective.framework binary due to the error:

screen shot 2018-04-03 at 11 40 53 am

*** Skipped installing ResponseDetective.framework binary due to the error:
"Incompatible Swift version - framework was built with 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2) and the local version is 4.1 (swiftlang-902.0.48 clang-902.0.37.1)."

I googled this similar issue seems other libraries such as this did complain about this too and it is related to Xcode 9.3 and Swift 4.1.

Migrate source to Swift 3.0

Source files should be migrated to Swift 3.0. API should be updated to conform to Swift API Guidelines, potentially breaking source compatibility. Β―_(ツ)_/Β―

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.