ios slcomposeviewcontroller with facebook - How can I get the posted image id?

265 views Asked by At

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?

1

There are 1 answers

1
efdalustaoglu On

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