Guest User

Untitled

a guest
Jul 19th, 2018
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. GDataServiceGooglePicasaWeb* service =
  2. [[GDataServiceGooglePicasaWeb alloc] init];
  3.  
  4. [service setUserCredentialsWithUsername:@"my.account@gmail.com"
  5. password:@"mypasswd"];
  6.  
  7. // get the URL for the album
  8. NSURL *albumURL = [GDataServiceGooglePicasaWeb
  9. picasaWebFeedURLForUserID:@"my.account" albumID:nil
  10. albumName:@"MyBestPhotos" photoID:nil kind:nil access:nil];
  11.  
  12. // set a title and description for the new photo
  13. GDataTextConstruct *title, *desc;
  14. title = [GDataTextConstruct textConstructWithString:@"Sunset Photo"];
  15. desc = [GDataTextConstruct textConstructWithString:@"A nice day"];
  16.  
  17. GDataEntryPhoto *newPhoto = [GDataEntryPhoto photoEntry];
  18. [newPhoto setTitle:title];
  19. [newPhoto setPhotoDescription:desc];
  20.  
  21. // attach the photo data
  22. NSData *data = [NSData dataWithContentsOfFile:@"/SunsetPhoto.jpg"];
  23. [newPhoto setPhotoData:data];
  24. [newPhoto setPhotoMIMEType:@"image/jpeg"];
  25.  
  26. // now upload it
  27. GDataServiceTicket *ticket;
  28. ticket = [service fetchPicasaWebEntryByInsertingEntry:newPhoto
  29. forFeedURL:albumURL
  30. delegate:self
  31. didFinishSelector:@selector(addPhotoTicket:finishedWithEntry:)
  32. didFailSelector:@selector(addPhotoTicket:failedWithError:)];
Add Comment
Please, Sign In to add comment