iOS {message:“资源正文包含不可直接写入的字段。”代码:403数据:[1]}

时间:2016-02-04 10:09:48

标签: ios google-drive-api google-api-client

developers.google.com更新最新的Google Drive SDK for iOS后,在我的应用中将文件从我的设备更新到我的云端硬盘时遇到此问题。我总是得到错误异常,并将消息作为标题。

我认为这是由后端Google REST API的变化造成的,但我不知道如何处理这个问题。以下代码与Google中名为iOS-QuickEditorSample tutorial .........

的示例代码几乎相同
NSData *fileContent =
[NSData dataWithContentsOfFile:localFilePath];
GTLUploadParameters *uploadParameters =
[GTLUploadParameters uploadParametersWithData:fileContent MIMEType:@"text/plain"]; 

GTLQueryDrive *query = 
[GTLQueryDrive queryForFilesUpdateWithObject:self.driveFile fileId:self.driveFile.identifier uploadParameters:uploadParameters];

[self.driveService executeQuery:query completionHandler:^(GTLServiceTicket *ticket,
                                                              GTLDriveFile *updatedFile,
                                                              NSError *error) {
// Do something after updating....
}];

0 个答案:

没有答案