当我尝试使用Google API将文件上传到Google时,收到了403错误消息

时间:2017-03-13 06:57:58

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

请帮忙,这是我的代码:

NSData * fileContent = [@"ahcnuefewfewfsnjcdsjc"     dataUsingEncoding:NSUTF8StringEncoding];
GTLRUploadParameters * uploadParameters = [GTLRUploadParameters uploadParametersWithData:fileContent MIMEType:@"text/plain"];
GTLRDrive_File * driveFile = [GTLRDrive_File new];
driveFile.name = @"First blood.txt";

GTLRDriveQuery_FilesCreate * query = [GTLRDriveQuery_FilesCreate queryWithObject:driveFile uploadParameters:uploadParameters];
query.fields = @"279683368406-cegfq720t7oe4j912m88pvl5qqbkv022.apps.googleusercontent.com";
self.driveService = [ GTLRDriveService new];
self.driveService.authorizer = self.authorization;

[self.driveService executeQuery:query completionHandler:^(GTLRServiceTicket * _Nonnull callbackTicket, id  _Nullable object, NSError * _Nullable callbackError) {

    if (!callbackError) {
        NSLog(@"---upLoad File Success---");
    }
    else{
        NSLog(@"---upLoad File fail---");
    }
}];

0 个答案:

没有答案