使用iPhone上的Objective C将图像上载到Picasa

使用iPhone上的Objective C将图像上载到Picasa,iphone,objective-c,api,picasa,Iphone,Objective C,Api,Picasa,我想知道是否有人知道他们用来上传图像到Picasa的代码信息。我真的只需要上传图像的代码,我有一切工作,以获得图像饲料和查看它,但走另一条路是给我一个问题 谷歌并没有提供任何关于如何做到这一点的好文档。任何帮助都将不胜感激,提前谢谢 检查此代码: GDataServiceGooglePicasaWeb* service = [[GDataServiceGooglePicasaWeb alloc] init]; [service setUserCredentialsWithUsername:@

我想知道是否有人知道他们用来上传图像到Picasa的代码信息。我真的只需要上传图像的代码,我有一切工作,以获得图像饲料和查看它,但走另一条路是给我一个问题

谷歌并没有提供任何关于如何做到这一点的好文档。任何帮助都将不胜感激,提前谢谢

检查此代码:

GDataServiceGooglePicasaWeb* service =
 [[GDataServiceGooglePicasaWeb alloc] init];

[service setUserCredentialsWithUsername:@"my.account@gmail.com"
 password:@"mypasswd"];

// get the URL for the album
NSURL *albumURL = [GDataServiceGooglePicasaWeb
 picasaWebFeedURLForUserID:@"my.account" albumID:nil
 albumName:@"MyBestPhotos" photoID:nil kind:nil access:nil];

// set a title and description for the new photo
GDataTextConstruct *title, *desc;
title = [GDataTextConstruct textConstructWithString:@"Sunset Photo"];
desc = [GDataTextConstruct textConstructWithString:@"A nice day"];

GDataEntryPhoto *newPhoto = [GDataEntryPhoto photoEntry];
[newPhoto setTitle:title];
[newPhoto setPhotoDescription:desc];

// attach the photo data
NSData *data = [NSData dataWithContentsOfFile:@"/SunsetPhoto.jpg"];
[newPhoto setPhotoData:data];
[newPhoto setPhotoMIMEType:@"image/jpeg"];

// now upload it
GDataServiceTicket *ticket;
ticket = [service fetchPicasaWebEntryByInsertingEntry:newPhoto
 forFeedURL:albumURL
 delegate:self
 didFinishSelector:@selector(addPhotoTicket:finishedWithEntry:)
 didFailSelector:@selector(addPhotoTicket:failedWithError:)];
来源:

检查此代码:

GDataServiceGooglePicasaWeb* service =
 [[GDataServiceGooglePicasaWeb alloc] init];

[service setUserCredentialsWithUsername:@"my.account@gmail.com"
 password:@"mypasswd"];

// get the URL for the album
NSURL *albumURL = [GDataServiceGooglePicasaWeb
 picasaWebFeedURLForUserID:@"my.account" albumID:nil
 albumName:@"MyBestPhotos" photoID:nil kind:nil access:nil];

// set a title and description for the new photo
GDataTextConstruct *title, *desc;
title = [GDataTextConstruct textConstructWithString:@"Sunset Photo"];
desc = [GDataTextConstruct textConstructWithString:@"A nice day"];

GDataEntryPhoto *newPhoto = [GDataEntryPhoto photoEntry];
[newPhoto setTitle:title];
[newPhoto setPhotoDescription:desc];

// attach the photo data
NSData *data = [NSData dataWithContentsOfFile:@"/SunsetPhoto.jpg"];
[newPhoto setPhotoData:data];
[newPhoto setPhotoMIMEType:@"image/jpeg"];

// now upload it
GDataServiceTicket *ticket;
ticket = [service fetchPicasaWebEntryByInsertingEntry:newPhoto
 forFeedURL:albumURL
 delegate:self
 didFinishSelector:@selector(addPhotoTicket:finishedWithEntry:)
 didFailSelector:@selector(addPhotoTicket:failedWithError:)];

来源:

我会检查一下,然后告诉你结果如何,不过现在我的老板要我用Flickr上传照片之类的东西。我更愿意使用Picasa,但这不是我的决定/这段代码在很大程度上起作用,但我遇到了一个问题,即出现了一个错误,说明我没有输入photoID。为了防止这种情况发生,我想我应该做一个,弥补一下。没有这样的运气。有什么建议可以给我发个代码吗。我甚至无法启动,因为我得到了Mac支持而不是iOS的代码。另外,我不了解谷歌API的集成。我会检查一下,让你知道它是如何工作的,除非现在我的老板想让我用Flickr上传照片之类的东西。我更愿意使用Picasa,但这不是我的决定/这段代码在很大程度上起作用,但我遇到了一个问题,即出现了一个错误,说明我没有输入photoID。为了防止这种情况发生,我想我应该做一个,弥补一下。没有这样的运气。有什么建议可以给我发个代码吗。我甚至无法启动,因为我得到了Mac支持而不是iOS的代码。另外,我不理解谷歌API的集成。