1
我期待使用Zimt庫和ZTWebSocket類有一個接受的NSString與此簽名一個「發送」方法:UTF8的NSString和Zimt的ZTWebSocket
- (void)send:(NSString *)message;
我想沿着數據作爲UTF8發送字符串,但該方法只接受常規的NSString。我該怎麼做才能避免編譯器警告?我可以從UTF8轉換爲常規字符串嗎?
websocket = [[ZTWebSocket alloc] ...];
// 1) this will also generate a warning about incompatible pointer type for the arguments
[websocket send:[message UTF8String]];
// 2) what happens during transmission if I cast this back to a regular string?
[websocket send:(NSString *)[message UTF8String]];