Upload images to Salesforce through iOS App - ios

I am trying to upload image to Salesforce just like updating Leads or Accounts through my Phonegap iOS app. I can get the image but by googling a bit, I got to know that i have to convert the image into a BLOB.
My query is about two things:
1. How to convert the image into a blob?
2. How to upload that blob to Salesforce?
Thanks in advance

A blob is just a Binary Large OBject, i.e. a lump of binary data. You just want to read the file into memory and use it's content directly. There may be a need to base64 encode it, but I wouldn't have thought so.
There's a Phonegap plugin for downloading binary data on iOS here, you can see how it uses the standard Apple SDK calls for file access, so opening them shouldn't be a problem for you.
The blog would be a field on an object, much like fields on your Accounts and Contacts, I'm not sure how you specify the size, but putting the binary data into the field shouldn't be a problem.
There's an example of using the REST API to upload binary data (to a document) here — I imagine your solution would be similar to this. What Salesforce API are you using for your app? Are you using their Mobile SDK?

You can attach images to Salesforce record on iPhone using Salesforce Mobile app. This requires a little customization - VF page and apex class. Once you have created the VF page for attachment, then you need add this VF page as 'Visualforce Tab' and enable it on Salesforce Mobile Configuration. Steps to add the newly created Visualforce Tab onto Salesforce Mobile Configuration : Setup->Mobile Administration->Salesforce Mobile->Configuration->'Select your Configuration'->Mobile Tab.
Now using this tab on Salesforce app, you can upload images as attachment.

Related

Manipulate PDF iOS (add signature)

I'm trying to find the best solution for my problem. User is using safari on an iPad, and at one point the customer contract is created using a webservice, which sends me the URL to a PDF file.
Right now the user opens the PDF, prints it and scans it after the customer signs the contract. What they want is to capture the signature digitally, so the contract doesn't need to be scanned later.
My question is: what is the best way to embed the signature to an existing pdf file?
I wanted something similar to what the iOS mail app does natively
http://heresthethingblog.com/2015/10/28/ios-9-tip-sign-pdf-mail-pdf-tricks/
Thanks

When using UIDocumentPicker, is there a way to know which external app the document is coming from?

I am using the UIDocumentPicker from iOS 8, uploading various documents from a number of different external apps such as Dropbox and Google Drive. Is there some way where I can know which app the user is getting the document from?
No. There is no API that provides this information. All you know is a temporary file URL for the selected file (when using the Import mode).

How to share text or image from ios app to Yammer

I need to share the text or image from one ios app to Yammer social network.
I am able to do login using iOS SDK of Yammer but not getting how can I share text or image from ios app to Yammer. I got the code to share text from browser but not from application.
Anybody has any idea??
Thanks in advance for your help and efforts.
This is documented on the Yammer API page. In order to post text and attach image
https://developer.yammer.com/v1.0/docs/messages-json-post
Parameters:
body - The text of the message body.
attachmentn and pending_attachmentn - Yammer provides two methods to associate attachments with a message. Both make use of multi-part HTTP upload (see RFC1867).
The first method is the easiest, simply use file form elements with names attachment1 through attachment20. If there are a several attachments or the attachments are large it may take some time for a message to POST causing your application to appear to hang.
An alternative way is to use the Pending Attachments resource (see below for details) allowing attachments to be uploaded in parallel. Apps that support HTTP chunked transfer encoding can monitor the progress of each upload. On success each pending attachment’s response body includes an id. These pending attachment ids are to be submitted with the message using form elements pending_attachment1 through pending_attachment20. Finally, if form elements for both attachmentN and pending_attachmentN are present only the pending_attachmentN elements will be honored.
I never used Yammer, but I wrote another app like Yammer used the given API, Yamme site should provide an API to share.

Push image from client side to users in ViewController from parse framework?

I am creating a demo application that uses parse framework. i want to show images in my UIImageView from my developer parse account to all users installed my app. How can i achieve this?
Waiting for your help.
Thanks :)
There are 2 ways you can store images on parse:
1) Create an object with field imageURL (for example) and store link to an image. In this case you will need to load image by this URL in your app (you can use AFNetworking UIImageView category to do it in background).
In this case you will need additional api to store images on server (or S3)
2) You can save image data at Parse. There is good documentation you can use to build it this way Store Images at Parse.com

Phonegap 3.0+ How to print a document and/or send it to another device via email/airdrop/etc without using Mobile Safari

I'm working on a Phonegap 3.1 iOS app.
What I have currently:
I'm using the InAppBrowser plugin to view user-uploaded documents from a server.
The document types users upload are commonly (but not limited to) the following:
.pdf
.png, .gif, .jpeg
.xls, .doc, .ppt
.txt
What I want to do:
Viewing the files works well in the InAppBrowser, but now I am exploring ways that users could send the documents to each other.Mobile Safari has a share button that allows a user to send a file by airdrop, message, mail, tweet, facebook or airprint. I cannot, however, use Safari since it is a non-negotiable requirement that I do not expose the URL where these files are hosted.
The InAppBrowser allows me to hide the location from the user, which is not possible with Mobile Safari. I want to be able to email and print a document without ever exposing the url where that document lives.
Is it possible to create the same sharing mechanism from within a Phonegap app?
What I know so far
I'm aware of the Phonegap File plugin for uploading and downloading files.
If I were to download a file from the server so it was stored locally, how would I go about making it shareable (through email, airdrop, etc)?
From what I can tell, there are no relevant Phonegap 3.0+ compliant plugins to achieve this so I would think I need to create my own. Am I on the right track?

Resources