0

I am curious how photos are labeled in Xcode. Basically, I am creating an app that accesses the camera to take a photo. When you go to the photo album of this app, it displays only the photos that have been taken by that app, however, I want the photos to also appear in the Camera Roll (hence, I don't want to save the photos taken by this app into their own directory). If I know how the photos are labeled, then I can store which photos are taken by this app in a database and tell the app to only list those photos taken by the app (presumably a TableView). It seems like there would be some sort of constant, such as PHOTO_INDEX or something like this...I assume it exists since when you save your photos to your computer from your iPhone, they're stored in this fashion. Any ideas?

1 Answers1

1

If you use the ALAssetsLibrary class you can easily do what you need:

void (^endBlock)(NSURL*, NSError*) =  ^(NSURL *url, NSError *e) {
  if (!e)
  {
    // you can use the url to do whatever you want, save the index of the image, save directly the url or what you need
  }
};

ALAssetsLibrary* lib = [[ALAssetsLibrary alloc] init];
[lib writeImageToSavedPhotosAlbum:[image CGImage] orientation:(ALAssetOrientation)[image imageOrientation] completionBlock:endBlock]
Jack
  • 131,802
  • 30
  • 241
  • 343