Permalink
Browse files

Fix some warnings in React.xcodeproj

Reviewed By: majak

Differential Revision: D4081860

fbshipit-source-id: 4b503df3c4e8b6e06b04613919a4a3405bf01171
  • Loading branch information...
javache authored and Facebook Github Bot committed Oct 27, 2016
1 parent 384ea33 commit 8bc30af6c811ce266c8e9b985273a447f8d18658
Showing with 29 additions and 29 deletions.
  1. +11 −5 React/Base/RCTMultipartDataTask.m
  2. +4 −7 React/Modules/RCTDevMenu.m
  3. +8 −5 React/Modules/RCTUIManager.m
  4. +6 −12 React/Views/RCTMapManager.m
@@ -57,7 +57,10 @@ - (void)startTask
[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 @@ - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)data
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;
View
@@ -525,8 +525,7 @@ - (void)addItem:(RCTDevMenuItem *)item
case RCTDevMenuTypeButton: {
[_actionSheet addAction:[UIAlertAction actionWithTitle:item.title
style:UIAlertActionStyleDefault
- handler:^(UIAlertAction *action) {
- // Cancel button tappped.
+ handler:^(__unused UIAlertAction *action) {
[item callHandler];
}]];
break;
@@ -535,23 +534,21 @@ - (void)addItem:(RCTDevMenuItem *)item
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;
}
}
}
[_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];
}
@@ -858,18 +858,21 @@ - (void)_removeChildren:(NSArray<UIView *> *)children
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<NSNumber *> *removeAtIndices = @[@(indexOfView)];
NSArray<NSNumber *> *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
@@ -289,25 +289,19 @@ - (MKAnnotationView *)mapView:(RCTMap *)mapView
return annotationView;
}
-- (MKOverlayRenderer *)mapView:(__unused MKMapView *)mapView
- rendererForOverlay:(RCTMapOverlay *)overlay
+- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)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(@{

0 comments on commit 8bc30af

Please sign in to comment.