2

I'm trying to integrate pin it button to my native ios App. Below is mycode for selecting image and storing ImageURL.

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
 chosenImage = info[UIImagePickerControllerEditedImage];
        self.imageView.image = chosenImage;
 NSURL* localUrl = (NSURL *)[info valueForKey:UIImagePickerControllerReferenceURL];
        imgURL = [NSString stringWithFormat:@"%@",localUrl];
 [picker dismissViewControllerAnimated:YES completion:NULL];
}

and for pinning Image

_pinterest = [[Pinterest alloc] initWithClientId:@"myID"];
[_pinterest createPinWithImageURL:[NSURL URLWithString:imgURL]
                            sourceURL:[NSURL URLWithString:@"http://www.social-pony.com/"]
                          description:@"Pinning from MyDemoApp"]; 

Where for imgURL is a String in which I'm storing ImagURL, This is what I get in imgURL when I printed the log "assets-library://asset/asset.PNG?id=CDA5C2B3-3CC0-4FF9-89E5-1F0F5205B7D8&ext=PNG" I know there is something wrong with the URL But This is the only way I know to get Image URL.

Thanks

MayurCM
  • 701
  • 1
  • 14
  • 31
  • You can't get Photolibrary images like this. The url is correct (because it represents the asset url). You need to use ALAssetLibrary for getting the image. – Midhun MP Jan 03 '14 at 06:19
  • http://stackoverflow.com/questions/13752039/any-way-to-upload-image-to-pinterest-with-ios-sdk-maybe-using-a-fileurl – Vizllx Jan 03 '14 at 06:22
  • 1
    You can use the code mentioned in this answer to get the image from photolibrary using ALAssetLibrary: http://stackoverflow.com/questions/14496910/unable-to-load-image-from-asset-url – Midhun MP Jan 03 '14 at 06:25
  • Thanks for the response. I tried the above answer But What am I suppose to pass as a imgURL?? should I pass "asseturl"? because I did so and I'm getting same URL and response. please bare with me – MayurCM Jan 03 '14 at 10:11

1 Answers1

0

Pinterest currently doesn't support uploading local images using the iOS SDK

See https://developers.pinterest.com/ios/

Right now, we only support adding an image from a URL. In the future, we’ll support adding local images.

Jack
  • 16,677
  • 8
  • 47
  • 51