소스 검색

Fix nullability annotation on . (#397)

Nikita Lutsenko 9 년 전
부모
커밋
8835ee3b13
2개의 변경된 파일7개의 추가작업 그리고 7개의 파일을 삭제
  1. 1 1
      SocketRocket/SRWebSocket.h
  2. 6 6
      SocketRocket/SRWebSocket.m

+ 1 - 1
SocketRocket/SRWebSocket.h

@@ -232,7 +232,7 @@ NS_DESIGNATED_INITIALIZER;
 
  @deprecated Please use `sendString:` or `sendData` instead.
  */
-- (void)send:(id)message __attribute__((deprecated("Please use `sendString:` or `sendData` instead.")));
+- (void)send:(nullable id)message __attribute__((deprecated("Please use `sendString:` or `sendData` instead.")));
 
 /**
  Send a UTF-8 String to the server.

+ 6 - 6
SocketRocket/SRWebSocket.m

@@ -621,14 +621,14 @@ NSString *const SRHTTPResponseErrorKey = @"HTTPResponseStatusCode";
     [self _pumpWriting];
 }
 
-- (void)send:(id)data;
+- (void)send:(nullable id)message
 {
-    if (!data) {
+    if (!message) {
         [self sendData:nil]; // Send Data, but it doesn't matter since we are going to send the same text frame with 0 length.
-    } else if ([data isKindOfClass:[NSString class]]) {
-        [self sendString:data];
-    } else if ([data isKindOfClass:[NSData class]]) {
-        [self sendData:data];
+    } else if ([message isKindOfClass:[NSString class]]) {
+        [self sendString:message];
+    } else if ([message isKindOfClass:[NSData class]]) {
+        [self sendData:message];
     } else {
         NSAssert(NO, @"Unrecognized message. Not able to send anything other than a String or NSData.");
     }