Closed 9oHigh closed 12 months ago
I'm getting the same issue. Last week this was working as expected but now.
Same question
Hi, you need to use development branch if use Pods add this on your target
pod 'Socket.IO-Client-Swift', :git => 'https://github.com/socketio/socket.io-client-swift.git', :branch => 'development'
then open on xcode the file SocketEngine.swift and add the nex code in the beginig
the file are Pods > Socket.IO.Client-Swift > SocketEngine.swift
public func didReceive(event: Starscream.WebSocketEvent, client: Starscream.WebSocketClient) { // TODO: Implement this method later switch event { case let .connected(headers): wsConnected = true self.client?.engineDidWebsocketUpgrade(headers: headers) websocketDidConnect() case .cancelled: wsConnected = false websocketDidDisconnect(error: EngineError.canceled) case .disconnected(, ): wsConnected = false websocketDidDisconnect(error: nil) case let .text(msg): parseEngineMessage(msg) case let .binary(data): parseEngineData(data) case _: break } }
your beginging code looks like
open class SocketEngine: NSObject, WebSocketDelegate, URLSessionDelegate, SocketEnginePollable, SocketEngineWebsocket, ConfigSettable { public func didReceive(event: Starscream.WebSocketEvent, client: Starscream.WebSocketClient) { // TODO: Implement this method later switch event { case let .connected(headers): wsConnected = true self.client?.engineDidWebsocketUpgrade(headers: headers) websocketDidConnect() case .cancelled: wsConnected = false websocketDidDisconnect(error: EngineError.canceled) case .disconnected(, ): wsConnected = false websocketDidDisconnect(error: nil) case let .text(msg): parseEngineMessage(msg) case let .binary(data): parseEngineData(data) case _: break } }
// MARK: Properties
private static let logType = "SocketEngine"
Hello @Fernando487, I want to import using swift package manager. So do I have to use development
branch instead of a exact
version number?
yes someting like this dependencies: [ .package(url: "https://github.com/socketio/socket.io-client-swift", .branch("development")) ]
an then change the code with my coding fix
Podfile add:
pod 'Starscream', :git => 'https://github.com/daltoniam/Starscream.git', :tag => '4.0.4'
Podfile add:
pod 'Starscream', :git => 'https://github.com/daltoniam/Starscream.git', :tag => '4.0.4'
This worked for me, thank you!
@Lves If I want to add socket-IO using SPM how can I declare the version of the Starscream?
@raf-wtag
.package(url: "https://github.com/daltoniam/Starscream", exact: "4.0.4"),
or
It is worked for me
Yes but as the starscream was being downloaded by the socket-IO itself, should I download the Starscream before the Socket-IO pod? Context: Using Swift Package Manager.
Yes but as the starscream was being downloaded by the socket-IO itself, should I download the Starscream before the Socket-IO pod? Context: Using Swift Package Manager.
If you explicitly specify the version of Starscream
, Xcode will use your declared version of Starscream
.
You can just add the package then it will work.
No need to specify the Starscream from our end as they have already added the fix here - https://github.com/socketio/socket.io-client-swift/commit/3c81d0ee55111a80a8f39b9c61782887ec98ceb4
Hoping for a new version release, if this will get this fixed.
The fix is in: https://github.com/socketio/socket.io-client-swift/commit/d7846b31a215211e595292425a2fdd6d16177faf
But there is no release yet. We need a new tag.
Tested Just now with this, the build completes successfully
Can we expect a proper fix that does not lock the version of Starscream? In complex projects where Starscream is also used this might cause conflicts.
@slice-dharamd do you lock the version of Starscream
or you get the proper Starscream
version from Scok-IO
directly?
Still breaks for swift package manager, for 16.0.1, perhaps release a patch update (16.0.2)?
@raf-wtag I locked the version of Starscream
If people want to try building with the development
branch and see if that is building for you, I will merge to master and cut a new release.
pod 'Socket.IO-Client-Swift', git: 'https://github.com/socketio/socket.io-client-swift.git', branch: 'development'
.package(url: "https://github.com/socketio/socket.io-client-swift", branch: "development")
Hello @nuclearace, I've tried import socket-IO
by checking out the development branch. It is working but -
I've a confusion regarding this, I thought as here the Starscream
version is locked this should download the 4.0.4 but after adding the socket-IO
using development
branch I'm noticing that it downloads the latest starscream version 4.0.4 but it is building successfully. Whereas If I checked out using 16.0.1
the starscream version is same (4.0.6) but the delegate problem persists.
@raf-wtag I had the same issue. Try cache reset for SPM or delete Pods/Socket.IO-Client-Swift
and Pods/Starscream
and let them download again.
Should be fixed in 16.1.0
The fix was made for the Swift package manager only. The podspec file is using starscream version 4.0.6.
@filipepereira-ag 16.1.0 should have podspec set to 4.0.6 with an updated SocketEngine implementation. Make sure you clear any previous build data before updating pods
Yes it's working. Thank you @nuclearace
Thank you for your quick handling : ) I'll close the issue.
Should be fixed in 16.1.0
One question about this... would I have to update my swift version as well? I've done that.. but now, getting errors like so:
.../platforms/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCORLibrary/GDTCORPlatform.m:87:43: error:
a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
GDTCORNetworkType GDTCORNetworkTypeMessage() {
^
void
.../platforms/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCORLibrary/GDTCORPlatform.m:102:61: error:
a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
GDTCORNetworkMobileSubtype GDTCORNetworkMobileSubTypeMessage() {
^
void
.../platforms/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCORLibrary/GDTCORPlatform.m:157:37: error:
a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
NSString *_Nonnull GDTCORDeviceModel() {
^
void
3 errors generated.
I could just open the files and add (void) to them, as it indicates. But I genuinely don't know if that's ideal... especially because I use bitrise to handle my apps. And if I hard coded that.. I'd have to find away to make that work later on a bitrise machine (maybe through podFiles?)...
anyways... any ideas? Does that make sense?
Recent updates to starcream cause the following problems when using version 16.0.1.
"Type 'SocketEngine' does not conform to protocol 'WebSocketDelegate'"