问题
I have 2 files.
"CodeInjection.m"
#import <Foundation/Foundation.h> #import "BiplovCodeInjection-Swift.h" @interface CodeInjection: NSObject @end @implementation CodeInjection static void __attribute__((constructor)) initialize(void){ NSLog(@"==== Code Injection in Action==== with sniffer"); [[CodeInjectionSwift shared] performTask]; } @end
My second file is.
"BiplovCodeInjectionSwift.swift"
import Foundation
import NetworkInterceptor
@objc class CodeInjectionSwift: NSObject {
@objc public static let shared = CodeInjectionSwift()
override private init(){}
@objc func performTask(){
let requestSniffers: [RequestSniffer] = [
RequestSniffer(requestEvaluator: AnyHttpRequestEvaluator(), handlers: [
SniffableRequestHandlerRegistrable.console(logginMode: .nslog).requestHandler()
])
]
let requestRedirectors: [RequestRedirector] = [
RequestRedirector(requestEvaluator: DomainHttpRequestEvaluator(domain: "www.antennahouse.com"), redirectableRequestHandler: AlternateUrlRequestRedirector(url: URL(string: "https://www.rhodeshouse.ox.ac.uk/media/1002/sample-pdf-file.pdf")!))
]
let networkConfig = NetworkInterceptorConfig(requestSniffers: requestSniffers,
requestRedirectors: requestRedirectors)
NetworkInterceptor.shared.setup(config: networkConfig)
NetworkInterceptor.shared.startRecording()
}
}
It fails on the line "#import "BiplovCodeInjection-Swift.h"
I built a new project > framework.
Here's my file strucuture
Why is it that I can't import the header file?
来源:https://stackoverflow.com/questions/58242172/not-able-to-import-project-name-swift-h-file-xcode