我正在快速开发一个 iOS 应用程序,其中 socket.io 库类是用目标 C 编写的。
当我将 Xcode 更新到 6.3.2 时,我遇到了很多错误
@protocol SocketIODelegate <NSObject>
@optional
- (void) socketIO:(SocketIO *)socket didReceiveMessage:(SocketIOPacket *)packet;
- (void) socketIO:(SocketIO *)socket didReceiveJSON:(SocketIOPacket *)packet;
- (void) socketIO:(SocketIO *)socket didReceiveEvent:(SocketIOPacket *)packet;
- (void) socketIO:(SocketIO *)socket didSendMessage:(SocketIOPacket *)packet;
- (void) socketIO:(SocketIO *)socket onError:(NSError *)error;
- (void) socketIO:(SocketIO *)socket onFailWithError:(NSError *)error;
@end
当我在 swift 类中实现这些委托方法时,我得到“定义与先前值冲突”
swift中实现的委托方法如下:
func socketIO(socket: SocketIO!, onFailWithError error: NSError!) {}
func socketIO(socket: SocketIO!, onError error: NSError!){}
func socketIO(socket: SocketIO!, didReceiveEvent packet: SocketIOPacket!) {}
如何解决这个问题?