0

I'm using socket.io swift client 4.1.2 everything works fine if I run the code from Xcode to a real device, the socket connection works, but if I do a distributed build (Ad-hoc) and install that into real device, the socket connection doesn't work.

Any idea why?

Thanks

ketaki Damale
  • 634
  • 7
  • 25
Cesar Oyarzun
  • 169
  • 2
  • 8

1 Answers1

0

Maybe, Are you using HTTPS at your requests? I said this because at iOS 9.X, any NSURLConnection will fail if it have a invalid certified at production/ad-hoc mode.

At least, you can do a temporary fix. Attention: It is a security flaw, then I do not recommend at production mode.

Before each request, you can set

[NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:@"domain.xx.zz"];

Ah, do not forget to add a interface at your class

@interface NSURLRequest (DummyInterface)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString*)host;
+ (void)setAllowsAnyHTTPSCertificate:(BOOL)allow forHost:(NSString*)host;
@end

If my hypothesis doest work or its invalid, please provide us with more information about your code or provide some kind of log.

You can check this StackOverflow thread to obtain more information on how to check the log using the command idevicesyslog:

iOS (iPhone, iPad, iPodTouch) view real-time console log terminal

Community
  • 1
  • 1
Victor Casé
  • 745
  • 8
  • 15
  • I'm using swift also the HTTPS connection works the only problem is with socket connection – Cesar Oyarzun Jan 08 '16 at 18:36
  • @CesarOyarzun did you check the log? – Victor Casé Jan 08 '16 at 19:02
  • how can I check the logs in a app that is already install?, I'm using distributed Ad-hoc for this – Cesar Oyarzun Jan 08 '16 at 19:11
  • @CesarOyarzun You can install your IPA via [link](http://diawi.com) and use the idevicesyslog to see what is happing with your sockets. I provided the tutorial on my answer. Sorry for the obj-c :( – Victor Casé Jan 08 '16 at 19:16
  • I check the logs and I see that I'm not able to connect to the socket, I'm using https://github.com/socketio/socket.io-client-swift. If I run the same code from xcode everything works. – Cesar Oyarzun Jan 11 '16 at 17:00
  • @CesarOyarzun Can you provide to us a piece of code from your socketIO initialization? Maybe are you using some kinda of build conditional macros? – Victor Casé Jan 12 '16 at 01:05