我正在使用iOS应用程序,我从我的iOS应用程序上传Picasa网络相册上的图像。当我首先创建相册时,我检查是否存在任何相同名称的相册,所以我用他们的名字获取所有相册和相册ID与下面的代码。
for (GDataEntryPhotoAlbum *albumEntry in feed)
{
NSString *title = [[albumEntry title] stringValue];
NSString *title1 = [albumEntry GPhotoID];
NSLog(@"File Title: %@ | ID: %@",title,title1);
}
我获得了所有专辑名称和专辑。 现在我查看用户提供的当前专辑名称。
if ([title isEqual:albumName]){
//do not create new album
// return the album id
}
else{
//create new album
}
一切正常,但现在的问题是如何将albumid发送到上面提到的上传方法:
- (void)_startUpload:(UIImage *)image:(NSString *)filePath{
NSLog(@"album feed is %@",albfeed);
// user/11106615845/albumid/6029121 gphotoID:60291215413
//GDataFeedPhotoAlbum *albumFeedOfPhotos = [self photoFeed];
//https://photos.googleapis.com/data/upload/resumable/media/create-session/feed/api/user/114789383162963173862/albumid/6025392474120084449
//https://photos.googleapis.com/data/entry/user/1082642086705/albumid/60254095886065
NSURL *uploadURL1 = [[[albfeed uploadLink] URL] retain];
NSString *photoPath = [[NSBundle mainBundle] pathForResource:@"red_bull" ofType:@"jpg"];
NSString *photoName = [photoPath lastPathComponent];
NSLog(@"uploadURL1 : %@",uploadURL1 );
NSLog(@"photoPath : %@",photoPath);
NSLog(@"photoName : %@",photoName);
NSData *photoData = [NSData dataWithContentsOfFile:filePath];
if (photoData) {
GDataEntryPhoto *newEntry = [GDataEntryPhoto photoEntry];
[newEntry setTitleWithString:photoName];
[newEntry setPhotoDescriptionWithString:filePath];
[newEntry setTimestamp:[GDataPhotoTimestamp timestampWithDate:[NSDate date]]];
[newEntry setPhotoData:photoData];
NSString *mimeType = [GDataUtilities MIMETypeForFileAtPath:filePath
defaultMIMEType:@"image/jpeg"];
[newEntry setPhotoMIMEType:mimeType];
[newEntry setUploadSlug:photoName];
GDataServiceGooglePhotos *service = [self googlePhotosService];
SEL progressSel = @selector(ticket:hasDeliveredByteCount:ofTotalByteCount:);
service.authToken = authTokens;
[service setServiceUploadProgressSelector:progressSel];
GDataServiceTicket *ticket;
ticket = [service fetchEntryByInsertingEntry:newEntry
forFeedURL:uploadURL1
delegate:self
didFinishSelector:@selector(addPhotoTicket:finishedWithEntry:error:)];
[service setServiceUploadProgressSelector:nil];
}else {
NSLog(@"@@@ Image not loaded");
}
i don't know how will i send the specific albumid so that i don't need to create a new album ,if that album is already found in my account.
我怎样才能实现?
我不想创建具有相同名称的另一张专辑,获取专辑并在上一张专辑中上传图片。 请帮帮我。 谢谢你宝贵的时间。