Browse Source

Fix build errors in iOS native code

Fox 7 years ago
parent
commit
b36a997999
1 changed files with 6 additions and 6 deletions
  1. 6
    6
      ios/RNViewShot.m

+ 6
- 6
ios/RNViewShot.m View File

@@ -19,11 +19,11 @@ RCT_EXPORT_MODULE()
19 19
   return RCTGetUIManagerQueue();
20 20
 }
21 21
 
22
-RCT_EXPORT_METHOD(captureScreenshot: (NSDictionary *)options
22
+RCT_EXPORT_METHOD(captureScreen: (NSDictionary *)options
23 23
                   resolve:(RCTPromiseResolveBlock)resolve
24 24
                   reject:(RCTPromiseRejectBlock)reject) 
25 25
 {
26
-  [captureRef -1, options, resolve, reject];
26
+  [self captureRef: [NSNumber numberWithInt:-1] withOptions:options resolve:resolve reject:reject];
27 27
 }
28 28
 
29 29
 RCT_EXPORT_METHOD(releaseCapture:(nonnull NSString *)uri)
@@ -48,7 +48,7 @@ RCT_EXPORT_METHOD(captureRef:(nonnull NSNumber *)target
48 48
     // Get view
49 49
     UIView *view;
50 50
 
51
-    if (target == -1) {
51
+    if ((int)target == -1) {
52 52
       UIWindow *window = [[UIApplication sharedApplication] keyWindow];
53 53
       view = window.rootViewController.view;
54 54
     } else {
@@ -102,11 +102,11 @@ RCT_EXPORT_METHOD(captureRef:(nonnull NSNumber *)target
102 102
       scrollView.frame = CGRectMake(0, 0, scrollView.contentSize.width, scrollView.contentSize.height);
103 103
     }
104 104
 
105
-    if (target == -1) {
105
+    if ((int)target == -1) {
106 106
       if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
107
-        UIGraphicsBeginImageContextWithOptions(currentView.window.bounds.size, NO, [UIScreen mainScreen].scale);
107
+        UIGraphicsBeginImageContextWithOptions(view.window.bounds.size, NO, [UIScreen mainScreen].scale);
108 108
       } else {
109
-        UIGraphicsBeginImageContext(currentView.window.bounds.size);
109
+        UIGraphicsBeginImageContext(view.window.bounds.size);
110 110
       }
111 111
     } else {
112 112
       UIGraphicsBeginImageContextWithOptions(size, NO, 0);