现在,我正在尝试使用如下所示的 Objective C 客户端将照片上传到 Picasa:
GDataServiceGooglePhotos* service =
[self photoService];
// get the URL for the album
NSURL *albumURL = [GDataServiceGooglePhotos
photoFeedURLForUserID:userEmailAdress albumID:albumName
albumName:nil photoID:nil kind:@"album" access:@"all"];
// set a title and description for the new photo
NSDateFormatter *df = [[NSDateFormatter alloc] init];
df.dateFormat = @"yyyyMMddHHmmssSSSS";
GDataTextConstruct *title, *desc;
title = [GDataTextConstruct textConstructWithString:[df stringFromDate:[NSDate date]]];
desc = [GDataTextConstruct textConstructWithString:[descriptionTextfield text]];
GDataEntryPhoto *newPhoto = [GDataEntryPhoto photoEntry];
[newPhoto setTitle:title];
[newPhoto setPhotoDescription:desc];
// attach the photo data
NSData *data = UIImageJPEGRepresentation(imageView.image, 1.0);
[newPhoto setPhotoData:data];
[newPhoto setPhotoMIMEType:@"image/jpeg"];
[newPhoto setUploadData:data];
[newPhoto setUploadMIMEType:@"image/jpeg"];
[newPhoto setUploadSlug:title.stringValue];
// now upload it
GDataServiceTicket *ticket;
ticket = [service fetchEntryByInsertingEntry:newPhoto forFeedURL:albumURL delegate:self didFinishSelector:@selector(addPhotoTicket:finishedWithEntry:error:)];
[service setServiceUploadProgressSelector:nil];
这是我的 addPhotoTicket:finishedWithEntry:error: 方法
if (error == nil) {
NSLog(@"UPLOADED");
} else {
NSLog(@"THERE WAS AN ERROR");
}
我不断收到“出现错误”,并且 failedWithStatus:400 数据:必须包含照片数据或源 ID。任何帮助是极大的赞赏。
谢谢。