Skip to content

Commit 1ac8f4f

Browse files
committed
Fix Xcode warnings
1 parent 3bc8e39 commit 1ac8f4f

File tree

6 files changed

+19
-11
lines changed

6 files changed

+19
-11
lines changed

Downloader.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ typedef void (^DownloadCompleteCallback)(NSNumber*, NSNumber*);
44
typedef void (^ErrorCallback)(NSError*);
55
typedef void (^BeginCallback)(NSNumber*, NSNumber*, NSDictionary*);
66
typedef void (^ProgressCallback)(NSNumber*, NSNumber*);
7-
typedef void (^ResumableCallback)();
7+
typedef void (^ResumableCallback)(void);
88

99
@interface RNFSDownloadParams : NSObject
1010

Downloader.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ - (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTas
9090
NSNumber* progress = [NSNumber numberWithUnsignedInt: floor(doublePercents)];
9191
if ([progress unsignedIntValue] % [_params.progressDivider integerValue] == 0) {
9292
if (([progress unsignedIntValue] != [_lastProgressValue unsignedIntValue]) || ([_bytesWritten unsignedIntegerValue] == [_contentLength longValue])) {
93-
NSLog(@"---Progress callback EMIT--- %zu", [progress unsignedIntValue]);
93+
NSLog(@"---Progress callback EMIT--- %u", [progress unsignedIntValue]);
9494
_lastProgressValue = [NSNumber numberWithUnsignedInt:[progress unsignedIntValue]];
9595
return _params.progressCallback(_contentLength, _bytesWritten);
9696
}
@@ -140,15 +140,15 @@ - (void)stopDownload
140140
[_task cancelByProducingResumeData:^(NSData * _Nullable resumeData) {
141141
if (resumeData != nil) {
142142
self.resumeData = resumeData;
143-
_params.resumableCallback();
143+
self->_params.resumableCallback();
144144
} else {
145145
NSError *error = [NSError errorWithDomain:@"RNFS"
146-
code:@"Aborted"
146+
code:0 //used to pass an NSString @"Aborted" here, but it needs an NSInteger
147147
userInfo:@{
148148
NSLocalizedDescriptionKey: @"Download has been aborted"
149149
}];
150150

151-
_params.errorCallback(error);
151+
self->_params.errorCallback(error);
152152
}
153153
}];
154154

RNFS.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
1010
s.license = pjson["license"]
1111
s.author = { "Johannes Lumpe" => "[email protected]" }
1212

13-
s.ios.deployment_target = '7.0'
13+
s.ios.deployment_target = '8.0'
1414
s.tvos.deployment_target = '9.2'
1515

1616
s.source = { :git => "https://github.com/itinance/react-native-fs", :tag => "v#{s.version}" }

RNFSManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#import <React/RCTBridgeModule.h>
1010
#import <React/RCTLog.h>
1111

12-
typedef void (^CompletionHandler)();
12+
typedef void (^CompletionHandler)(void);
1313

1414
@interface RNFSManager : NSObject <RCTBridgeModule>
1515

RNFSManager.m

+11-3
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,15 @@ + (BOOL)requiresMainQueueSetup
157157
[fH writeData:data];
158158

159159
return resolve(nil);
160-
} @catch (NSException *e) {
161-
return [self reject:reject withError:e];
160+
} @catch (NSException *exception) {
161+
NSMutableDictionary * info = [NSMutableDictionary dictionary];
162+
[info setValue:exception.name forKey:@"ExceptionName"];
163+
[info setValue:exception.reason forKey:@"ExceptionReason"];
164+
[info setValue:exception.callStackReturnAddresses forKey:@"ExceptionCallStackReturnAddresses"];
165+
[info setValue:exception.callStackSymbols forKey:@"ExceptionCallStackSymbols"];
166+
[info setValue:exception.userInfo forKey:@"ExceptionUserInfo"];
167+
NSError *err = [NSError errorWithDomain:@"RNFS" code:0 userInfo:info];
168+
return [self reject:reject withError:err];
162169
}
163170
}
164171

@@ -808,7 +815,8 @@ + (BOOL)requiresMainQueueSetup
808815
rejecter: (RCTPromiseRejectBlock) reject)
809816
{
810817
NSURL* url = [NSURL URLWithString:imageUri];
811-
__block NSURL* videoURL = [NSURL URLWithString:destination];
818+
//unused?
819+
//__block NSURL* videoURL = [NSURL URLWithString:destination];
812820
__block NSError *error = nil;
813821

814822
PHFetchResult *phAssetFetchResult = [PHAsset fetchAssetsWithALAssetURLs:@[url] options:nil];

Uploader.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ - (void)uploadFiles:(RNFSUploadParams*)params
106106
NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfiguration delegate:(id)self delegateQueue:[NSOperationQueue mainQueue]];
107107
_task = [session dataTaskWithRequest:req completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
108108
NSString * str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
109-
return _params.completeCallback(str, response);
109+
return self->_params.completeCallback(str, response);
110110
}];
111111
[_task resume];
112112
_params.beginCallback();

0 commit comments

Comments
 (0)