The company recently decided to eliminate Websockets and move all the way to SocketIO for long connections between clients and servers. There are a lot of information about SocketIO on the Internet.

Because the OC version of SocketIO is very old and has various problems, we use the latest Swift version here. Let’s start integrating with Cocopods. SocketIO does not currently support manual imports, so manual imports will keep reporting errors.

use_frameworks! #OC projects do not use use_frameworks by default, but should add target 'your App name' do pod 'socket. io-client-swift ', '~> 15.0.0' endCopy the code

then

pod install
Copy the code

The CocoaHTTPServer library is not running properly

image.png

The solution

Continue to run, continue to report errors. There are a lot of errors like this in the project, this is ok, just change the Angle brackets to double quotation marks, these two differences can be found.

image.png

Library not found for -lXXXXX library not found for -lXXXXX The solution

Continue to run, continue to report errors. I can’t find webP in SD.

image.png

SD is manually dragged to the project, YY is POD, and Webp library is in THE POD sub-project of YY. It is also easy to change. The project deletes SD and then imports THE SD Webp

pod 'SDWebImage/WebP'
Copy the code

Then pod install and continue the run project successfully.

Tips

Showing Recent Messages The Swift Language Version (SWIFT_VERSION) buildCopy the code

Sometimes the above error is reported, in this case, specify the Swift version number. If the Settings still do not work, you need to check the version of Xcode. If the version is too early, Swift5 is not supported. You need to update the system and update Xcode.