iOS – 在Google Drive API上使用上传图片(错误“GTLServer …中的声明失败”)

我正在尝试在iOS应用中使用Google云端硬盘。 我尝试上传文件,出现以下错误:

2013-06-17 14:38:57.964 GTL Demo[6495:11303] *** Assertion failure in -[GTLService uploadFetcherWithRequest:fetcherService:params:](), /Users/huylx612/demo2/google-api-objectivec-client-read-only/Source/Objects/GTLService.m:565 2013-06-17 14:38:58.049 GTL Demo[6495:11303] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'GTMHTTPUploadFetcher needed' *** First throw call stack: (0x1e01012 0x1307e7e 0x1e00e78 0xd9d6d0 0x3d0ba 0x3cb55 0x3de06 0x42a89 0x3642 0x2ee4 0x44ee3e 0xed7ed11 0xed772fd 0xedfa9f8 0x131b6b0 0xd47765 0x1d84f3f 0x1d8496f 0x1da7734 0x1da6f44 0x1da6e1b 0x21947e3 0x2194668 0x24bffc 0x26bd 0x25e5) libc++abi.dylib: terminate called throwing an exception (lldb) 

这是我的相关代码:

 - (void)uploadPhoto:(UIImage*)image { NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"'Quickstart Uploaded File ('EEEE MMMM d, YYYY h:mm a, zzz')"]; GTLDriveFile *file = [GTLDriveFile object]; file.title = [dateFormat stringFromDate:[NSDate date]]; file.descriptionProperty = @"Uploaded from the Google Drive iOS Quickstart"; file.mimeType = @"image/png"; NSData *data = UIImagePNGRepresentation((UIImage *)image); GTLUploadParameters *uploadParameters = [GTLUploadParameters uploadParametersWithData:data MIMEType:file.mimeType]; GTLQueryDrive *query = [GTLQueryDrive queryForFilesInsertWithObject:file uploadParameters:uploadParameters]; UIAlertView *waitIndicator = [self showWaitIndicator:@"Uploading to Google Drive"]; [self.driveService executeQuery:query completionHandler:^(GTLServiceTicket *ticket,GTLDriveFile *insertedFile, NSError *error) { [waitIndicator dismissWithClickedButtonIndex:0 animated:YES]; if (error == nil) { NSLog(@"File ID: %@", insertedFile.identifier); [self showAlert:@"Google Drive" message:@"File saved!"]; } else { NSLog(@"An error occurred: %@", error); [self showAlert:@"Google Drive" message:@"Sorry, an error occurred!"]; } }]; } 

帮我!

GTMHTTPUploadFetcher没有链接,请-ObjC -all_load到其他链接标志选项。