Hi ! Thank you for reporting an issue, but we would like to remind you, we have a trouble shooting page in our wiki.
You may want to take a look on that page or find issues tagged "trouble shooting" :p
@joltup
I am done with this https://github.com/Jacse/rn-fetch-blob#ios-background-uploading but still not working, please check if anyone has an idea @joltup
Thanks
Someone knows a library that works on background for ios?
Hi,
I am also looking for IOS background upload support, here is my code
RNFetchBlob.config({ IOSBackgroundTask: true, }) .fetch('POST', videoPath, { 'ClientToken': access_token, 'Content-Type' : 'application/octet-stream', }, RNFetchBlob.wrap(fileUrl)) .then((res) => { console.log('res',res.text()) }) .catch((err) => { console.log('err',err) })
while uploading data to server, if application is moved to background and again brining back to foreground RNFetchBlob callbacks are not getting called and showing loading continuously.
can anyone help me to fix this issue
Thanks
Hi,
after adding the following code in AppDelegate, i am able to upload file in background
//AppDelegate.h
@property (nonatomic, assign) UIBackgroundTaskIdentifier taskIdentifier;
// AppDelegate.m
- (void)applicationWillResignActive:(UIApplication *)application {
if (self.taskIdentifier != UIBackgroundTaskInvalid) {
[application endBackgroundTask:self.taskIdentifier];
self.taskIdentifier = UIBackgroundTaskInvalid;
}
__weak typeof(self) weakSelf = self;
self.taskIdentifier = [application beginBackgroundTaskWithName:nil expirationHandler:^{
[application endBackgroundTask:weakSelf.taskIdentifier];
weakSelf.taskIdentifier = UIBackgroundTaskInvalid;
}];
}
here is my RNFetchBlob code
RNFetchBlob.config({ IOSBackgroundTask: true, }) .fetch('POST', videoPath, { 'ClientToken': access_token, 'Content-Type' : 'application/octet-stream', }, RNFetchBlob.wrap(fileUrl)) .then((res) => { console.log('res',res.text()) }) .catch((err) => { console.log('err',err) })
@venkataluri thanks it worked really. @mustafakemalelma
Most helpful comment
Hi,
after adding the following code in AppDelegate, i am able to upload file in background
here is my RNFetchBlob code
RNFetchBlob.config({ IOSBackgroundTask: true, }) .fetch('POST', videoPath, { 'ClientToken': access_token, 'Content-Type' : 'application/octet-stream', }, RNFetchBlob.wrap(fileUrl)) .then((res) => { console.log('res',res.text()) }) .catch((err) => { console.log('err',err) })