Html File In Messages App Not Viewing correctly - ios

I have code that is generating an HTML file that is being sent via iMessage to another iPhone user. However, in the messages App on the receiving end, when they click on the HTML file, the formatting is super bare. (I know the HTML file works, because I forward it to a computer and it displays fine) There's none of the images displayed on the HTML file when viewed in the Messages App, and I have a Youtube video embedded that is not being displayed. My best guess is that the Messages app is stripping away all of this information... So how could I go about displaying my HTML file correctly? Could I somehow force it to open in Safari? I tried converting the HTML file to a PDF with no luck. Thanks.

Edit
Not possible. iMessage sends text messages as SMS, images or videos as MMS, which may incur extra cost to your user if they are not on WIFI. Never seen a HTML being sent with image and video before.
You can send the HTML file via email. And if you provide a link in your email, the Mail app will open it in Safari automatically.
There are many answers on sending mail from iPhone apps: one here

Related

Remove need to press "Tap to Load Preview" for iPhone OpenGraph SMS Message

I am trying to be able to send SMS messages with links that contain OpenGraph preview images which will load in the iOS "Messages" application and will display the thumbnail without the user having to press [Tap To Load Preview] first... How can this be achieved?
For this, I am sending a text SMS message to an iPhone X which is running iOS 10 and opened with the Messages app.
The text message body contains a URL that points to a resource (a HTML web page) whose body contains OpenGraph metadata with an og:image tag. Eg:
<meta property="og:image" content="https://www.apple.com/v/iphone/home/t/images/home/og.png?201610171354" />
For presentation purposes, we are trying to make it so that the image will load first and immediately, without the user having to tap the button in order to to see it...
Expected Behavior:
Actual Behavior:
As a side note, on the Android clients we have tested, where OpenGraph is supported the image will display instantly without the user being prompted to do anything. The same is true for any other OpenGraph supported application tested, including Facebook.
For reference, here are some of the methods I've tested to try to get this working for us (as well as combinations therein):
Tried serving the image directly with no intermediate redirects, also tried with redirects.
Tried serving PNG and JPG images.
Tried serving the images from URL's containing no more than 20 characters where the URL has the ".jpg" and ".png" parameters and no additional GET parameters. Also tried when the extensions aren't part of the link.
Tried serving the image from the server by referencing its IP directly instead of using a public domain name.
Tried with GET parameters as well, with random numbers to clarify a totally unique URL each time.
Tried serving the image from HTTPS and HTTP links.
Tried serving with dynamically generated images, which should entail a brief delay of some milliseconds while the image is rendered and served.
Tried an enforced sleep in the script that responds to the URL page as well as for the image request to induce an intentional delay of some milliseconds and experimented with various settings for that.
Tried serving the image with a variety of different dimensions, portrait and landscape as well as extremely large and extremely small and other variants between (50x50, 60x50, etc and up).
Always ensured that the image is <1 MB in size, but also tested larger images anyway to see if they would work.
Tried serving images from the same canonical source that the phone or Message service might already 'recognise' as 'trusted' as we have already loaded the preview from those those in the past (testing if such a feature exists, which it probably doesn't).
Tried specifically, all suggestions as noted Apple Technical Note "Best Practices for Link Previews in Messages" see https://developer.apple.com/library/content/technotes/tn2444/_index.html
Tried moving the OG tags outside of the <head> of the page.
Tried stripping of the page of all tags except for pertinent og:image tags.
Tried removing HTTP headers for the response to the GET to the image resource so that just the image itself is returned. Tried then adding back the Content-Type header alone.
Tried priming the request to the image to respond with various HTTP specification cache-invalidating related headers..
Tried sending from various phone numbers US and Australian, also tried changing the "From" field for the SMS message itself to strings like "VERIZON", "Verizon", "Telstra", "APPLE", "Apple", "Facebook", "Uber", "China".
Tried sending the messages from handheld phone as well as from the Twilio Messaging API service.
None of the above work for an iPhone X.
There is no way to do this with SMS. If you send it as an iMessage it will automatically display the preview.
On iPhones the preview is generated on the device rather than server-side. When a user taps preview their device sends 4 GET requests to the server. If the preview was generated automatically there would be a security vulnerability. You could send a text to any iPhone user and get their IP Address.
With iMessages the preview is generated automatically but there is no security vulnerability. The device sending the link sends 4 GET requests to the server, generates the preview and then transmits the preview to the recipient via iMessages. As a result, the receiving device has no need to send a request to the server to generate a preview. And their IP Address is not known to the owner of a webserver.
On Google's Android Messaging app the preview is generated server side. There is one GET request sent to the web server. But it originates from the Android Messages server. So again the owner of the webserver does not receive the recipient's IP Address from their receipt of the text.

How to send a link in an SMS so that the preview is loaded automatically?

I am using twilio to send SMS messages to phone numbers. What I am having problems with is making sure that once a user gets the message the preview of what is at a certain link actually loads in the message the user sees on the phone.
What is the proper way to send a link that automatically shows the preview?
EDIT:
I tried the open graph api. Apple does have a tech note on that. But, then, why does this link provided a proper preview in messages when I send this link to another phone? It works, and it does not use open graph.
https://i1.wp.com/www.asphaltandrubber.com/wp-content/uploads/2017/11/2018-Ducati-Panigale-V4-29.jpg?ssl=1
a couple of things you can try
have the link at start of the message or end of the message
the link should be properly formatted with either http:// or https://
iOS uses The Open Graph protocol to support what image to show in the link . http://ogp.me/

Is there a way to send content from my app, which is not from my app?

I have a theoretical question to the file system/restriction from iOS.
In an Android app I can open a file from filesystem, with my app, and send it via mail or send it to a REST-service.
This is not possible under iOS, because there is no filesystem like under Android.
As far as I know I can only send file, which are created by my app.
Is there a way to send content from my app, which is not from my app?
For example a pdf received per mail, opened in my app and send it to a server or something else.
best regards
Yes, you can make your app eligible to open specific type of files ( images, videos, pdf, docs, etc )
see https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/RegisteringtheFileTypesYourAppSupports.html
After that you bring the url file and you can work on it locally into your app, or uploading the linked file on a server as well

Objective-c Attaching multiple PDF's to email

I have an app for our field sales team that generates customer data based on some inputs. The sales rep can then email that data as an attached PDF doc (created programmatically in the app). I also have a stored PDF document with some marketing information on our products that also gets attached to the email. This PDF was created in Apple's Pages and imported into the bundle and then is moved to the docs directory.
My problem is when I attach the programmatically created PDF, the app functions fine. When I attach the stored PDF file, in the email on the iPad both attachments have the .pdf extension but when I receive them in my email (Lotus Notes - I know, I know : ( ) both files come with .pdf.zip extensions and cannot be opened.
If I send just the stored one, the same, .pdf.zip.
On my desktop I can open the original file and read it in Preview and Adobe Reader so it doesn't seem corrupted. Any ideas as to what is going on here?
Thanks

ics attachment not present in gmail

I have implemented a calendar in my website (Ruby on Rails) and i have also successfully generated an .ics file. I want to send this file as an attachment in an email.
I have set the mime as text/calendar
I also set the content_type as multipart/alternative
The attachment is sent successfully in the email on all major email clients except gmail
How to make the .ics attachment appear in the email. has anyone faced this kind of a problem before. I checked in various google help forums and many have faced this issue, but no concrete solution has been found.
In Gmail, click the "more" down arrow. One of the options is "Show original". Select that.
When the window opens, scroll down. You should see the VCalendar area. Gmail is ignoring it.
In this area, look for the line that starts as "Organizer;" If you are listed as the organizer, then gmail ignores the ics file. This is a "feature"
We built a web page for ourselves that we copy that text into and it strips that line out and re-emails the ics to us. Then it works fine. (with just a little more work, you could set up an email intercept wherein you forward that email to someplace where you have a parser that grabs the VCalendar, strips out the organizer, and emails it back to you.
We asked Google to put a feature request in to change this, but it's unlikely to happen.
Good Luck.

Resources