Countly / countly-sdk-ios

Countly Product Analytics iOS SDK with macOS, watchOS and tvOS support.
https://count.ly
MIT License
618 stars 244 forks source link

NSURLProtocol #93

Closed dadpp closed 8 years ago

dadpp commented 8 years ago

This sdk with a custom NSURLProtocol conflict, use only one

dadpp commented 8 years ago

import "BCCustomURLProtocol.h"

static NSString * const BCURLProtocolHandledKey = @"BCURLProtocolHandledKey";

@interface BCCustomURLProtocol ()

@property (nonatomic, strong) NSURLConnection *connection;

@end

@implementation BCCustomURLProtocol

pragma mark - NSURLConnectionDelegate

+(NSMutableURLRequest)redirectHostInRequset:(NSMutableURLRequest)request { if ([request.URL host].length == 0) { return request; }

NSString *originUrlString = [request.URL absoluteString];
NSString *originHostString = [request.URL host];
NSRange hostRange = [originUrlString rangeOfString:originHostString];
if (hostRange.location == NSNotFound) {
    return request;
}

NSLog(@"拦截到的URL===%@",[request.URL host]);

// NSLog(@"lanjie URL===%@",request.URL.description); return request; }

@end

erkanyildiz commented 8 years ago

Can you explain what this is?

dadpp commented 8 years ago

@erkanyildiz NSURLProtocol custom

erkanyildiz commented 8 years ago

I mean the issue. Can you explain what kind of problem you experience and why do you think it has something to do with Countly SDK?

If you are trying to use Countly APM feature, it has issues with AFNetworking and some other 3rd party libraries: https://github.com/Countly/countly-sdk-ios/issues/82

If something else, please explain.

dadpp commented 8 years ago

Use NSURLProtocol UIWebView loading, UIWebView loading out

erkanyildiz commented 8 years ago

Duplicate of #82