Domanda

I wanna get the folder's identifier immediately when I upload the folder to google drive. for example:

- (NSString *) folderupload:(NSString *)parentid
           foldername:(NSString *)foldername
{
    GTLDriveFile *folderObj = [GTLDriveFile object];
    folderObj.title = foldername;
    folderObj.mimeType = @"application/vnd.google-apps.folder";
    GTLDriveParentReference *parentRef = [GTLDriveParentReference object];
    parentRef.identifier = parentid;
    folderObj.parents = [NSArray arrayWithObject:parentRef];
    GTLQueryDrive *query = [GTLQueryDrive queryForFilesInsertWithObject:folderObj
                                                       uploadParameters:nil];
    NSString *identify = nil;
    [service executeQuery:query
    completionHandler:^(GTLServiceTicket *ticket,
                        GTLDriveFile *insertedFile,
                        NSError *error){
        if (error == nil) {
            identify = insertedFile.identifier;
            NSLog(@"OK");
        } else {
            NSLog(@"%@ upload ERROR!",localpath);
            int value = arc4random() % 2;
            sleep(4+value);
            [self fileupload:localpath
                    filename:filename
                    mimetype:mimetype
                    parentid:parentid];
            NSLog(@"try again");
        }
    }];
    return identify;
}

But when I call the method folderupload,the method return null,and the method upload the folder succeed.How to get the folder's id?

Nessuna soluzione corretta

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top