You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.
When I use startUploadRequest to upload image data to server, it throw a exception:
"Upload tasks from NSData are not supported in background sessions"
the code is such like that:
//------------------------------------------------------------------------------------------------------------------------------
MKNetworkRequest *request = [self.host requestWithPath:@"MyUrl" params:finalSendParams httpMethod:@"POST"];
[request attachData:data forKey:@"img" mimeType:@"image/jpeg" suggestedFileName:@"img.jpg"];
[self.host startUploadRequest:request];
//------------------------------------------------------------------------------------------------------------------------------
in function -(void) startUploadRequest:(MKNetworkRequest*) request;
use the backgroundSession like that:
request.task = [self.backgroundSession uploadTaskWithRequest:request.request
fromData:request.multipartFormData];
maybe we can only upload files "fromFile" in backgroundSession rather then "fromData".
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When I use startUploadRequest to upload image data to server, it throw a exception:
"Upload tasks from NSData are not supported in background sessions"
the code is such like that:
//------------------------------------------------------------------------------------------------------------------------------
MKNetworkRequest *request = [self.host requestWithPath:@"MyUrl" params:finalSendParams httpMethod:@"POST"];
[request attachData:data forKey:@"img" mimeType:@"image/jpeg" suggestedFileName:@"img.jpg"];
[self.host startUploadRequest:request];
//------------------------------------------------------------------------------------------------------------------------------
in function -(void) startUploadRequest:(MKNetworkRequest*) request;
use the backgroundSession like that:
request.task = [self.backgroundSession uploadTaskWithRequest:request.request
fromData:request.multipartFormData];
maybe we can only upload files "fromFile" in backgroundSession rather then "fromData".
The text was updated successfully, but these errors were encountered: