-2

I am integrating the Podio SDK. I am getting all data item values and updating also, but images won't upload. Any idea? I don't know how to upload an image on Podio SDK.

NSData *data = UIImageJPEGRepresentation(self.ImgView_Sign.image, 0.8f);

[[[PKTFile uploadWithData:data fileName:@"mobi.jpg"] pipe:^PKTAsyncTask *(PKTFile *file){

    PKTItem *item = [PKTItem itemForAppWithID:431525395];
    item[@"title"] = @"CHEKRI";
    item[@"signautre"] = file;
    return [item save];

}] onSuccess:^(PKTItem *item){
    NSLog(@"PKT FILE is %@",item);

} onError:^(NSError *error){

    NSLog(@"Error file %@",error);
}];
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
mobi
  • 1
  • 3
  • 1
    Please show, what you would consider your best try. Code preferred, no bitmaps. Thanks. – Dilettant Jul 11 '16 at 11:42
  • Error Domain=PodioServerErrorDomain Code=404 "No matching operation could be found. Missing parameters: source." UserInfo={PKTErrorDescription=No matching operation could be found. Missing parameters: source., PKTErrorParameters={ }, PKTErrorPropagate=false, NSLocalizedDescription=No matching operation could be found. Missing parameters: source., PKTError=not_found} i got this error please tell me how to fix it.. – mobi Jul 11 '16 at 13:49

2 Answers2

0

Please use below code might be work for you.

UIImage *image = [UIImage imageNamed:@"some-image.jpg"];
NSData *data = UIImageJPEGRepresentation(image, 0.8f);

PKTAsyncTask *uploadTask = [PKTFile uploadWithData:data fileName:@"image.jpg"];

[uploadTask onComplete:^(PKTFile *file, NSError *error) {
  if (!error) {
    NSLog(@"File uploaded with ID: %@", @(file.fileID));
  }
}];
Hitesh Surani
  • 12,733
  • 6
  • 54
  • 65
  • Thanks for reply , But above code is not working for me..i already create item id just i need upload signature of item id how can i upload signature for item id. pls reply me... – mobi Jul 11 '16 at 11:59
  • Error Domain=PodioServerErrorDomain Code=404 "No matching operation could be found. Missing parameters: source." UserInfo={PKTErrorDescription=No matching operation could be found. Missing parameters: source., PKTErrorParameters={ }, PKTErrorPropagate=false, NSLocalizedDescription=No matching operation could be found. Missing parameters: source., PKTError=not_found} – mobi Jul 11 '16 at 13:47
  • During googling i have found something for you. This is not a answer but less resource available for podio SDK . – Hitesh Surani Jul 12 '16 at 05:47
  • https://help.podio.com/hc/en-us/community/posts/203036218-FileUpload-method-gets-404-error-I-have-attached-tested-request-am-i-missing-anything-Could-u-please-give-me-suggestions- – Hitesh Surani Jul 12 '16 at 05:47
0

Adding an image to an image field is a two-step process.

First you must upload the file. https://developers.podio.com/doc/files/upload-file-1004361 will give you a file object with a file_id you need in step two.

Step two is to create a new item, update an item or update the field value. Here you pass the file_id as a the value for the field.

We have a general tutorial on working with items here https://developers.podio.com/examples/items

Working with file_ids for image fields is not different than the other field types. Just as you use profile_ids to work with Contact fields you use file_ids to work with image fields.


Original source: https://help.podio.com/hc/en-us/community/posts/200516608-API-image-upload-to-Image-Field

domokun
  • 3,013
  • 3
  • 29
  • 55