Reputation: 1
The example ...
https://code.google.com/p/google-api-objectivec-client/wiki/Introduction#Uploading_Files
... uses NSFileHandle ...
NSFileHandle *fileHandle = [NSFileHandle fileHandleForReadingAtPath:path];
if (fileHandle) {
NSString *mimeType = @"image/jpeg";
GTLUploadParameters *uploadParameters = [GTLUploadParameters uploadParametersWithFileHandle:fileHandle
MIMEType:mimeType];
... which means that you would need to (re)persist the ALAssetRepresentation to disk to be able to get a NSFileHandle, instead of just using ALAssetRepresentation getBytes:, and using NSData ...
GTLUploadParameters *uploadParameters = [GTLUploadParameters uploadParametersWithData:uploadData
MIMEType:fileObj.mimeType];
... is there a way to stream the ALAssetRepresentation NSData to the GTLServiceDrive query?
Trying to ALAssetRepresentation getBytes: for a large video into memory causes a crash.
Also, re(persisting) the ALAssetRepresentation to disk seems like waste - extra processing time & space (that may not exist).
Surely there is a nice way to do this with the Google Drive iOS SDK & direct ALAssetRepresentation streamed NSData?
Upvotes: 0
Views: 147
Reputation: 12673
The DriveSDK only works with NSFileHandle, and from what I can tell there is no way to convert between an ALAssetRepresentation to a NSFileHandle except persisting to disk. See this related Stack Overflow question.
Upvotes: 0