New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working on iOS 8 #7

Open
Casper8016 opened this Issue Sep 28, 2014 · 14 comments

Comments

Projects
None yet
5 participants
@Casper8016

Casper8016 commented Sep 28, 2014

static CFDictionaryRef new_SCDynamicStoreCopyProxies (SCDynamicStoreRef store) {
if (!activated || !proxyPref)
return origin_SCDynamicStoreCopyProxies(store);
NSLog(@"AppProxyCap: proxify configuration applied: %@", proxyPref);
return CFDictionaryCreateCopy(NULL, (CFDictionaryRef)proxyPref);
}

new_SCDynamicStoreCopyProxies Not working on iOS 8 send http request

@tuoxie007

This comment has been minimized.

Show comment
Hide comment
@tuoxie007

tuoxie007 Sep 28, 2014

You can use NSURLSessionConfiguration as an alternative.

NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
configuration.connectionProxyDictionary =
@{(NSString *)kCFStreamPropertySOCKSProxyHost: @"127.0.0.1",
  (NSString *)kCFStreamPropertySOCKSProxyPort: @(8889)};
NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];

tuoxie007 commented Sep 28, 2014

You can use NSURLSessionConfiguration as an alternative.

NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
configuration.connectionProxyDictionary =
@{(NSString *)kCFStreamPropertySOCKSProxyHost: @"127.0.0.1",
  (NSString *)kCFStreamPropertySOCKSProxyPort: @(8889)};
NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];
@Casper8016

This comment has been minimized.

Show comment
Hide comment
@Casper8016

Casper8016 Sep 28, 2014

Thank you very much for your reply
But I think we need to ask the next global use kCFStreamPropertySOCKSProxy in webview in
Is to use [NSURLSession sharedSession] related way?

Casper8016 commented Sep 28, 2014

Thank you very much for your reply
But I think we need to ask the next global use kCFStreamPropertySOCKSProxy in webview in
Is to use [NSURLSession sharedSession] related way?

@tuoxie007

This comment has been minimized.

Show comment
Hide comment
@tuoxie007

tuoxie007 Sep 28, 2014

You could use NSURLProtocol to proxy all the traffic.
[NSURLProtocol registerClass:[MyURLProtocol class]];

tuoxie007 commented Sep 28, 2014

You could use NSURLProtocol to proxy all the traffic.
[NSURLProtocol registerClass:[MyURLProtocol class]];

@Casper8016

This comment has been minimized.

Show comment
Hide comment
@Casper8016

Casper8016 Sep 29, 2014

Are there ready to use [NSURLProtocol registerClass: [MyURLProtocol class]]; proxy forwards the request to use the example project can refer to it? Thank you very much

Casper8016 commented Sep 29, 2014

Are there ready to use [NSURLProtocol registerClass: [MyURLProtocol class]]; proxy forwards the request to use the example project can refer to it? Thank you very much

@Casper8016

This comment has been minimized.

Show comment
Hide comment
@Casper8016

Casper8016 Sep 29, 2014

The latest Tweet4China2 using this mode of failure of open source projects like the ah, there you have it? Can re-release it? :)

Casper8016 commented Sep 29, 2014

The latest Tweet4China2 using this mode of failure of open source projects like the ah, there you have it? Can re-release it? :)

@tuoxie007

This comment has been minimized.

Show comment
Hide comment
@tuoxie007

tuoxie007 Sep 29, 2014

No, T4C is using NSURLSession instead of AF.
The source of T4C, as a paid app now, should be protected.

tuoxie007 commented Sep 29, 2014

No, T4C is using NSURLSession instead of AF.
The source of T4C, as a paid app now, should be protected.

@Casper8016

This comment has been minimized.

Show comment
Hide comment
@Casper8016

Casper8016 Sep 29, 2014

Success, thanks for your help :)

Casper8016 commented Sep 29, 2014

Success, thanks for your help :)

@Casper8016

This comment has been minimized.

Show comment
Hide comment
@Casper8016

Casper8016 Sep 29, 2014

Forwarding the request [[self client] URLProtocol: self didLoadData: data]; webview in ios7 on normal, but in ios8 direct collapse is why?

Casper8016 commented Sep 29, 2014

Forwarding the request [[self client] URLProtocol: self didLoadData: data]; webview in ios7 on normal, but in ios8 direct collapse is why?

@tuoxie007

This comment has been minimized.

Show comment
Hide comment
@tuoxie007

tuoxie007 Sep 29, 2014

It works great in my project, did you do it as below?

self.session = [NSURLSession sessionWithConfiguration:configuration];
self.task = [self.session dataTaskWithRequest:self.request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
    if (error) {
        [self.client URLProtocol:self didFailWithError:error];
    } else {
        [self.client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageAllowed];
        [self.client URLProtocol:self didLoadData:data];
        [self.client URLProtocolDidFinishLoading:self];
    }
}];
[self.task resume];

tuoxie007 commented Sep 29, 2014

It works great in my project, did you do it as below?

self.session = [NSURLSession sessionWithConfiguration:configuration];
self.task = [self.session dataTaskWithRequest:self.request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
    if (error) {
        [self.client URLProtocol:self didFailWithError:error];
    } else {
        [self.client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageAllowed];
        [self.client URLProtocol:self didLoadData:data];
        [self.client URLProtocolDidFinishLoading:self];
    }
}];
[self.task resume];
@Casper8016

This comment has been minimized.

Show comment
Hide comment
@Casper8016

Casper8016 Sep 29, 2014

Success, very very thanks for your help :)

Casper8016 commented Sep 29, 2014

Success, very very thanks for your help :)

@wenpinger1221

This comment has been minimized.

Show comment
Hide comment
@wenpinger1221

wenpinger1221 commented Jan 1, 2015

R

@vzrao

This comment has been minimized.

Show comment
Hide comment
@vzrao

vzrao Apr 7, 2016

does this work on video request, like HLS or MP4?

vzrao commented Apr 7, 2016

does this work on video request, like HLS or MP4?

@freewizard

This comment has been minimized.

Show comment
Hide comment
@freewizard

freewizard Apr 7, 2016

Owner

@vzrao depends on your iOS version, most likely not, because media playback in recent iOS use a separate process to load the streams.

Owner

freewizard commented Apr 7, 2016

@vzrao depends on your iOS version, most likely not, because media playback in recent iOS use a separate process to load the streams.

@vzrao

This comment has been minimized.

Show comment
Hide comment
@vzrao

vzrao Apr 8, 2016

@freewizard that's what I guess. any idea how to achieve that besides using a local proxy?

vzrao commented Apr 8, 2016

@freewizard that's what I guess. any idea how to achieve that besides using a local proxy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment