function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nirmal VasanthakumarNirmal Vasanthakumar 

How to access attachments from salesforce object to native iOS app.

I am building a native iOS app.I want to populate images in the attachments of a salesforce object to the app.I  can query to get body from object as  /services/data/v23.0/sobjects/Attachment/xxxxxxxxxxxxxxx/Body. I tried to send this body field of attachment  via a asihttp request with request header Authorization which gives response string as ÿØÿà. 

 

Summary: Any method to access salesforce files to native iOS app.

 

Thank you very much in advance.

Gaurav KheterpalGaurav Kheterpal

Take a look at this class. This works for audio attachments but the logic would remain the same.

 

https://github.com/mbotos/CaseMemo/blob/master/iOS/CaseMemo/DetailViewController.m

 

Let me know if that helps.

 

Regards,
Gaurav

Nirmal VasanthakumarNirmal Vasanthakumar

Thanks.

However I managed to access images via attachments directly by sending request to salesforce via salesforceinstanceURL + file path of the body and with header in request as

Authorization value:"Bearer" +salesforceaccessToken. The response contains the image as data.

 

Thanks for Your effort.

 

 

 

Mahek PatelMahek Patel
Hi Nirmal Vasanthakumar

I would like to fetch image from custom object's attachment. I have tried to fetch image using following code

SFRestRequest *request = [SFRestRequest requestWithMethod:SFRestMethodGET path:path queryParams:nil];
   
    [[SFRestAPI sharedInstance] send:request delegate:self];

Where path is BODY URL of attachment but its not working. Please suggest me what is missing in request or give me some working example.
Nithya venkatNithya venkat
Hi Nirmal Vasanthakumar,

I also wanted to fetch image from attachemnt.
Could you please help me on posting the sample code of fetching attachemnt part ?

Thanks in advance.

Regards,
Nive