0

I'm using slcomposeviewcontroller in my iOS app. When a user shares an image in my application to facebook using the slcomposeviewcontroller I'd like to get the id of the photo he created. I see that there's a handler called completionHandler but it doesn't return any id.

What workaround do I have for getting the shared image id?

vondip
  • 13,809
  • 27
  • 100
  • 156

1 Answers1

0

The project I'm working right now requires an image id like yours. I tested it and it's working, here you are..

- (void) collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{


    ALAsset *asset = self.assets[indexPath.row];//Which image are you pressed in a imagepickerview

    ALAssetRepresentation *defaultRep = [asset defaultRepresentation];
    NSString *tmp1=[[defaultRep url] absoluteString];
    NSArray *imageID ;

    imageID = [tmp1 componentsSeparatedByString: @"id="];
    imageID=[imageID[1] componentsSeparatedByString: @"&ext"];
    NSLog(@"image id is : %@",imageID[0]);
}
efdalustaoglu
  • 168
  • 11