简体   繁体   中英

Socket swift not working enterprise distributed build

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM