I use my app to receive data by using this method:
-(void)udpSocket:(GCDAsyncUdpSocket *)sock didReceiveData:(NSData *)data
fromAddress:(NSData *)address withFilterContext:(id)filterContext {
NSLog(@"didReceiveData");
NSString* input = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"%@", input);
if ([input isEqual:@"LEDCube"]) {
//do something
}
Even though I send "LEDCube", the if statement always returns 0, that makes me unable to go further.
From NSLog, the content of input is "LEDCube". Therefore, I suspect that the problem is at the NSUTF8StringEncoding. How to deal with this problem?
Thank you in advance