无法通过谷歌驱动器API上传/下载文件

我试图从我的应用程序上传图片到谷歌驱动器,但其显示错误

错误域= com.google.HTTPStatus代码= 501 “(空)” 的UserInfo = {数据= <7b226572 726f7222 3a7b2263 6f646522 3a343033 2c226d65 73736167 65223a22 496e7375 66666963 69656e74 20506572 6d697373 696f6e22 2c226461 7461223a 5b7b2264 6f6d6169 6e223a22 676c6f62 616c222c 22726561 736f6e22 3a22696e 73756666 69636965 6e745065 726d6973 73696f6e 73222c22 6d657373 61676522 3a22496e 73756666 69636965 6e742050 65726d69 7373696f 6e227d5d 7d2c2269 64223a22 67746c5f 35227d>}

我的代码是

NSData *data = UIImageJPEGRepresentation(ImageView.image, 1.0); NSString *mimeType = @"image/png"; GTLDriveFile *metadata = [GTLDriveFile object]; GTLUploadParameters *uploadParameters = [GTLUploadParameters uploadParametersWithData:data MIMEType:mimeType]; GTLQueryDrive *query=[GTLQueryDrive queryForFilesCreateWithObject:metadata uploadParameters:uploadParameters]; [_service executeQuery:query completionHandler:^(GTLServiceTicket *ticket, GTLDriveFile *updatedFile, NSError *error) { if (error == nil) { NSLog(@"File %@", updatedFile); } else { NSLog(@"An error occurred: %@", error); } }]; 

在这两项行动中,我无权进行更改。 下面的代码在我的项目。

 NSFileHandle *fileHandle = [NSFileHandle fileHandleForReadingAtPath:self.fromPath]; GTLUploadParameters *uploadParameters = [GTLUploadParameters uploadParametersWithFileHandle:fileHandle MIMEType:mimeType]; GTLQueryDrive *uploadFileQuery = [GTLQueryDrive queryForFilesCreateWithObject:toFile uploadParameters:uploadParameters];