我想從我的應用程序谷歌驅動器上傳圖片,但其示值誤差無法上傳/通過谷歌驅動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);
}
}];
我不知道如何獲得訪問和上傳圖像的權限 –