Comments (1)
Hi @vinceplusplus The SDK does not currently support resumable item upload directly however you can still use the SDK to create a resumable session and upload fragments to that session.
To do this you will first need to call
ODChunkedUploadSessionDescriptor *sessionDescriptor = [[ODChunkedUploadSessionDescriptor alloc] init];
sessionDescriptor.name = self.currentItem.name;
ODCreateItemSessionRequest *request = [[[[self.client drive] items:self.currentItem.id] createSessionWithItem:sessionDescriptor] request]
[request executeWithCompletion:^(ODUploadSession *response, NSError *error){
NSURL *fileURL = [NSURL URLWithString:@"path/to/file"];
// You must write getNextRange yourself, note that according to the documentation
// This should be somewhere between 5-10 MiB and if possible a multiple of 320 KiB
NSRange startRange = [self getNextRange:fileURL start:0];
//You must write sendFragment yourself
[self sendFragment:[NSURL URLWithString:response.uploadUrl] withFile:[NSURL URLWithString:@"path/to/fil"] range:startRange];
}];
Send fragment would look something like:
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:uploadUrl];
[self.client.authProvider appendAuthHeaders:request completion:^(NSMutableURLRequest *requestToSend, NSError *error){
if (requestToSend){
NSData *fragment = [self getFragmentFromFile:fileURL withRange:byteRange];
[self appendContentHeaders:requestToSend withFile:fileURL range:byteRange];
[[self.client.httpProvider uploadTaskWithRequest:requestToSend fromData:fragment progress:nil completionHandler:^(NSData *data, NSURLResponse *response, NSError *error){
if (((NSHTTPURLResponse*)response).statusCode == 202){
NSRange nextRange = [self getNextRange:fileURL fromResponse:response :data];
[self sendFragment:uploadUrl withFile:fileURL range:nextRange];
}
}] resume];
}
}];
Make sure to take a look at the resumable upload documentation For specifics about fragment size and some other notes. Supporting fragment upload fully in the SDK is on our radar, and hopefully we will implement it in the future.
from onedrive-sdk-ios.
Related Issues (20)
- library not found for -lADAL HOT 2
- OneDrive for Business - New Apps will not work due to Office 365 Discovery API Deprecation HOT 10
- Streamable path of file HOT 1
- Download thumbnail HOT 2
- improvement: Supply thumbnail urls in item request instead of having a separate request
- nameConflict not work
- Is this sdk outdated? HOT 5
- Discovery API will be deprecated
- One Drive Login PresentContrller iOS13
- Deprecated API Usage (UIWebView) HOT 6
- Urgent :: Use of deprecated ADAL version HOT 11
- IOS onedrive SDK needs to be updated. Uiwebview has been abandoned and needs to be replaced with wkwebview HOT 1
- Can't Sign in with MS account HOT 2
- Install without pods ?
- H
- Asd
- P
- webDavUrl does not work in mobile platform
- OneDrive SDK for iOS
- OneDrive for Business cTag not updated when folder contents changes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from onedrive-sdk-ios.