上传图片至Picasa与iPhone目标C [英] Upload image to Picasa with Objective C on iPhone

查看:146
本文介绍了上传图片至Picasa与iPhone目标C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如果任何人有,他们已经习惯了图像上传到Picasa code的任何信息。我真的只需要code上传图片,我的一切努力让图像饲料和查看,但走另一条路是给我的一个问题。

I was wondering if anyone had any information of code that they have used to upload an image to Picasa. I really only need the code to upload images, I have everything working to get the image feed and view it, but going the other way is giving me a problem.

谷歌并没有真正提供如何做到这一点任何好的文档。任何帮助将大大AP preciated,先谢谢了!

Google does not really provide any good documentation for how to do this. Any help would be greatly appreciated, thanks in advance!

推荐答案

勾选此code:

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:)];

来源:的http://googlemac.blogspot.com/2007/06/picasa-web-albums-meets-google-data.html

这篇关于上传图片至Picasa与iPhone目标C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆