diff --git a/React/Base/RCTMultipartDataTask.m b/React/Base/RCTMultipartDataTask.m index daee3d16d..0fb1623db 100644 --- a/React/Base/RCTMultipartDataTask.m +++ b/React/Base/RCTMultipartDataTask.m @@ -57,7 +57,10 @@ static BOOL isStreamTaskSupported() { [dataTask resume]; } -- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler +- (void)URLSession:(__unused NSURLSession *)session + dataTask:(__unused NSURLSessionDataTask *)dataTask +didReceiveResponse:(NSURLResponse *)response + completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler { if ([response isKindOfClass:[NSHTTPURLResponse class]]) { NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; @@ -86,22 +89,25 @@ static BOOL isStreamTaskSupported() { completionHandler(NSURLSessionResponseAllow); } -- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error +- (void)URLSession:(__unused NSURLSession *)session task:(__unused NSURLSessionTask *)task didCompleteWithError:(NSError *)error { _partHandler(_statusCode, _headers, _data, error, YES); } -- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data +- (void)URLSession:(__unused NSURLSession *)session dataTask:(__unused NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data { [_data appendData:data]; } -- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didBecomeStreamTask:(NSURLSessionStreamTask *)streamTask +- (void)URLSession:(__unused NSURLSession *)session dataTask:(__unused NSURLSessionDataTask *)dataTask didBecomeStreamTask:(NSURLSessionStreamTask *)streamTask { [streamTask captureStreams]; } -- (void)URLSession:(NSURLSession *)session streamTask:(NSURLSessionStreamTask *)streamTask didBecomeInputStream:(NSInputStream *)inputStream outputStream:(NSOutputStream *)outputStream +- (void)URLSession:(__unused NSURLSession *)session + streamTask:(__unused NSURLSessionStreamTask *)streamTask +didBecomeInputStream:(NSInputStream *)inputStream + outputStream:(__unused NSOutputStream *)outputStream { RCTMultipartStreamReader *reader = [[RCTMultipartStreamReader alloc] initWithInputStream:inputStream boundary:_boundary]; RCTMultipartDataTaskCallback partHandler = _partHandler; diff --git a/React/Modules/RCTDevMenu.m b/React/Modules/RCTDevMenu.m index f0fc6a296..160e40b92 100644 --- a/React/Modules/RCTDevMenu.m +++ b/React/Modules/RCTDevMenu.m @@ -525,8 +525,7 @@ RCT_EXPORT_METHOD(show) case RCTDevMenuTypeButton: { [_actionSheet addAction:[UIAlertAction actionWithTitle:item.title style:UIAlertActionStyleDefault - handler:^(UIAlertAction *action) { - // Cancel button tappped. + handler:^(__unused UIAlertAction *action) { [item callHandler]; }]]; break; @@ -535,11 +534,10 @@ RCT_EXPORT_METHOD(show) BOOL selected = [item.value boolValue]; [_actionSheet addAction:[UIAlertAction actionWithTitle:(selected? item.selectedTitle : item.title) style:UIAlertActionStyleDefault - handler:^(UIAlertAction *action) { + handler:^(__unused UIAlertAction *action) { BOOL value = [self->_settings[item.key] boolValue]; [self updateSetting:item.key value:@(!value)]; // will call handler }]]; - break; } } @@ -547,11 +545,10 @@ RCT_EXPORT_METHOD(show) [_actionSheet addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel - handler:^(UIAlertAction *action) { - }]]; + handler:nil]]; _presentedItems = items; - [RCTPresentedViewController() presentViewController:_actionSheet animated:YES completion:^(void){}]; + [RCTPresentedViewController() presentViewController:_actionSheet animated:YES completion:nil]; } diff --git a/React/Modules/RCTUIManager.m b/React/Modules/RCTUIManager.m index 1e35ca958..b1be51732 100644 --- a/React/Modules/RCTUIManager.m +++ b/React/Modules/RCTUIManager.m @@ -858,18 +858,21 @@ RCT_EXPORT_METHOD(replaceExistingNonRootView:(nonnull NSNumber *)reactTag RCTAssert(shadowView != nil, @"shadowView (for ID %@) not found", reactTag); RCTShadowView *superShadowView = shadowView.superview; - RCTAssert(superShadowView != nil, @"shadowView super (of ID %@) not found", reactTag); + if (!superShadowView) { + RCTAssert(NO, @"shadowView super (of ID %@) not found", reactTag); + return; + } NSUInteger indexOfView = [superShadowView.reactSubviews indexOfObject:shadowView]; RCTAssert(indexOfView != NSNotFound, @"View's superview doesn't claim it as subview (id %@)", reactTag); NSArray *removeAtIndices = @[@(indexOfView)]; NSArray *addTags = @[newReactTag]; [self manageChildren:superShadowView.reactTag - moveFromIndices:nil - moveToIndices:nil - addChildReactTags:addTags + moveFromIndices:nil + moveToIndices:nil + addChildReactTags:addTags addAtIndices:removeAtIndices - removeAtIndices:removeAtIndices]; + removeAtIndices:removeAtIndices]; } RCT_EXPORT_METHOD(setChildren:(nonnull NSNumber *)containerTag diff --git a/React/Views/RCTMapManager.m b/React/Views/RCTMapManager.m index 78fc2f094..875e46c0d 100644 --- a/React/Views/RCTMapManager.m +++ b/React/Views/RCTMapManager.m @@ -289,25 +289,19 @@ RCT_CUSTOM_VIEW_PROPERTY(region, MKCoordinateRegion, RCTMap) return annotationView; } -- (MKOverlayRenderer *)mapView:(__unused MKMapView *)mapView - rendererForOverlay:(RCTMapOverlay *)overlay +- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id)overlay { - if ([overlay isKindOfClass:[RCTMapOverlay class]]) { - MKPolylineRenderer *polylineRenderer = - [[MKPolylineRenderer alloc] initWithPolyline:overlay]; - polylineRenderer.strokeColor = overlay.strokeColor; - polylineRenderer.lineWidth = overlay.lineWidth; - return polylineRenderer; - } else { - return nil; - } + RCTAssert([overlay isKindOfClass:[RCTMapOverlay class]], @"Overlay must be of type RCTMapOverlay"); + MKPolylineRenderer *polylineRenderer = [[MKPolylineRenderer alloc] initWithPolyline:overlay]; + polylineRenderer.strokeColor = [(RCTMapOverlay *)overlay strokeColor]; + polylineRenderer.lineWidth = [(RCTMapOverlay *)overlay lineWidth]; + return polylineRenderer; } - (void)mapView:(RCTMap *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { if (mapView.onPress) { - // Pass to JS RCTMapAnnotation *annotation = (RCTMapAnnotation *)view.annotation; mapView.onPress(@{