-
Notifications
You must be signed in to change notification settings - Fork 831
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
Self Signed Cert #326
Comments
Yeah, you'll probably need to use SessionDelegate as well. I don't have any examples of that, but you should be able find some online. |
Ok, thank you |
@dani5447 hello ,How you solve? |
@j364960953 I had to
|
thanks! |
1 similar comment
thanks! |
@dani5447 Thanks, this helped me .. 👍 :) |
I am using this swift library in obj-c project. With respect to this issue, I have written this code as follows but my delegate never gets called. Any idea what could be missing? socket = [[SocketIOClient alloc] initWithSocketURL:url config:@{@"log": @yES, @"forcePolling": @yES, @"selfSigned": @yES, @"sessionDelegate":self }]; Add here is my delegate.
|
I got it working. |
@githubforIT how to fix it? |
Actually, when I implemented the didReceiveChallenge delegate method in the AppDelegate and set the sessionDelegate to its instance, it started working. AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate]; |
I want to try local notifications using SOCKETIO., when the app is running on simulator everything is fine. But when It's running on iPhone, when the app enters into background task suspends/ get paused. Please help me regarding this issue |
@githubforIT I tried to use the same method as you, however, I often get an AppDelegate retain message sent to deallocated instance error. May I ask, Did you encounter an error on the same path as mine? |
@githubforIT Thank you so much for pointing out to the The 3 changes I made to your solution are:
@interface MainViewController () <NSURLSessionDelegate>
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler {
// Trust self-signed HTTPS certificate:
completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
}
@property (nonatomic) SocketManager *socketManager;
NSURL* url = [[NSURL alloc] initWithString:@"https://192.168.1.1:123"]; // The HTTPS location, can even be on a local network.
_socketManager = [[SocketManager alloc] initWithSocketURL:url config:@{@"log": @YES,
@"forcePolling": @YES,
@"selfSigned": @YES,
@"sessionDelegate": self}]; |
It's not working in my particular case for some reason, and I'm wondering if I'm not quite using the option correctly. Do I need to use .SessionDelegate as well? If so, do you have any examples?
Here is a code snippet, fairly basic:
And the error code I still get despite using the .SelfSigned opts is below:
The text was updated successfully, but these errors were encountered: