我有这个功能来检查来自 udp 连接的数据
- (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag
{
NSString *response = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSString *hello = @"hello";
if(response == hello){
[self debugPrint:[NSString stringWithFormat:@"ok"]];
}
else{
[self debugPrint:[NSString stringWithFormat:@"Read: \n%@",response]];
}
[response release];
}
我发送了一个“hello”,但它从不返回“ok”消息,它跳转到 else{}
任何人都可以帮忙吗?谢谢