XCODE / IOS - How to use exclusive extension to immediately present whatsapp (.wai, .waa, .wam) - ios

Is there any way to make work that part of the whatsapp document interaction API:
Alternatively, if you want to show only WhatsApp in the application list (instead of WhatsApp plus any other public/*-conforming apps) you can specify a file of one of aforementioned types saved with the extension that is exclusive to WhatsApp:
images - «.wai» which is of type net.whatsapp.image
videos - «.wam» which is of type net.whatsapp.movie
audio files - «.waa» which is of type net.whatsapp.audio
When triggered, WhatsApp will immediately present the user with the contact/group picker screen. The media will be automatically sent to a selected contact/group.
I don't really ask for a code example as I almost tried eveything, but more if someone ever successfully opened the whatsapp application WITHOUT passing through the share menu (with messenger tile, whatsapp, notepad...) ?

FYI: As I went through a lot of tests with this, I couldn't find any solution yet.
Whatsapp recognize the file extension, but cannot even read it. Once shared, when you click on it, it's written ".whatsapp audio file", nothing more (And it's not even shared directly).
I sent a email to whatsapp developper team, they said they have others problem to fix currently, so it's not even on their to do list.
Wait & see..

Related

How can I open my app directly from the iOS Share Sheet?

Update: don't have time yet to test provided answer, but will keep this answer updated as I try different things.
In the iOS 14 Simulator, when I open the share sheet and click their Share Target, the Apple News app is launched immediately and they check if the shared URL has been added to their index.
My question is how are they launching their app immediately without any user interaction?
A gif is worth about 100,000 words: https://giphy.com/gifs/HPzTNyWGDDMVwASQ9z
I would imagine it may be some combination of registering a Universal Link and then programmatically triggering that from the Share Extension View Controller, but I’m wondering if anyone has any better ideas.
A couple of other places I've asked:
Swift Subreddit
iOS Programming Subreddit
This is just an open URL call to a news app. Prior to iOS 14, it was named as copy to app name.
To achieve this you need to specify the supported document type for your application in plist using key CFBundleDocumentTypes.
Refer to apple documentation for more info:
https://help.apple.com/xcode/mac/current/#/devddd273fdd
There is a change in share sheet option listings.
case 1: When your application doesn't support any kind of extension. And have supported document add to plist. Your application will appear in the share sheet for supporting documents. On tap, your application gets an OpenURL call with the URL of the document shared.
case 2: Your application supports share extension or action extension, then your open URL call option for your application will not appear in the share sheet. if the share extension and action extension activation predicate are not satisfied and the document shared is supported by your application that option will appear the same as case 1. (Summary: if share extension or action extension is listed in share sheet then open URL option will not be listed.)
Note: Limitation of openURL call is, it supports only a single URL. For example, you are sharing multiple files, your application OpenURL option will appear. But on tap, your application will receive only one URL.
If your requirement is sharing only a single URL and your application doesn't have a share extension and action extension. Then key CFBundleDocumentTypes is your friend.

Sending a file via AirDrop (iOS) and the recipient is not given the opportunity to accept/reject the file

I've made it possible to send a serialised object via AirDrop. I've added both a custom Document Type and an Exported UTI.
Sending and receiving the file is working just fine - in that the recipient can process and use the data as expected.
However, when testing this process between my devices the files are automatically accepted - the recipient isn't given the opportunity to accept/reject.
Normally, when sharing files via AirDrop the user is given the opportunity to accept or reject, so I'm wondering if I need to do something to ensure this happens? But, I haven't seen anything in Apple's documentation relating to this...
Any suggestions?
Ah! This turned out to be a non-problem.
I've been testing the application using two of my own devices (iPhone and iPad). The key here is that the same user / Apple ID is signed into each device.
In this case, when sharing data using AirDrop files are accepted automatically. I confirmed this by sending a photo from the Photos app between the same devices and the same auto-acceptance was observed.
When expanding the test to use someone else's iPhone, data shared via AirDrop from my app did get the system's Accept/Reject dialog.
Nothing to code. Nothing to do.

Saving files from an iOS app extension to the containing app

I'm working on adding the ability to use the share button to allow users to save files for use with my main application. Multiple file types (image, video, audio, pdf, etc) need to be supported.
A general use case would be:
The user takes a picture with the standard Camera app or audio recording using the Voice Memos app.
User clicks the Share button and selects my extension from the share list.
Dialog opens up giving the user to opportunity to give a description for the file.
File is saved to where my main app (the containing app) can later access and process it.
I've been able to get to the point where I am prompted to share the file, but I have not been able to find a location to successfully save to that my main app can later read from. Is this even possible? Is there a better way to handle this scenario?
I am currently doing this using Xamarin so debugging is not supported (and logging is minimal). If someone has an answer in Objective C, that would at least help point me in the right direction.
There are a few things that you need to do.
First, your app and your app extension should belong to the same app group:
https://developer.apple.com/library/prerelease/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW19
Then you can access the shared storage with something like this:
var groupUrl = NSFileManager.DefaultManager.GetContainerUrl ("stackoverflow.com.mygroup")
Now you can access files in the directory pointed by groupUrl.
Xamarin's guide to creating Share extensions for iOS: http://developer.xamarin.com/guides/ios/platform_features/introduction_to_extensions/

"Open in" feature in UIActivityViewController

I need your help with UIActivityViewController.
I need to present activity controller for the file where, except for default actions, the user will be able to open the file in other apps.
I know how to do this with UIDocumentController, which shows popover with all apps able to open the file.
But how can I show all these apps in UIActivityViewController?
P.S. This behavior can be seen in Apple Mail app, for example.
Look at TTOpenInAppActivity for a way to combine both a UIActivityViewController (for normal sharing), and an 'Open in' button on that which brings up a UIDocumentInteractionController. Pre-iOS 8, that is the best way to manage this.
The function and behavior is different between UIActivityViewController and UIDocumentController.
UIActivityViewController
Presents activities that are pre-defined, you can pass an array to select which ones should be excluded among the default ones that are presented, if you want to add more activities you have to use custom activities, unfortunately these will appear bellow the rest of the activities and even more, the icon will always be gray, your app never loses control since you can use delegates and other stuff to know what is going on on those apps. (Unless you manually make an activity which opens another app)
UIDocumentController
This one asks the system for all the registered applications for a certain file extension, many apps have registered their exclusive extensions which makes it so that this app will be the only one displayed. If you pass an image, you will see all the apps that can handle this file. When using this one your app will lose control since the other app will be opened.
What is your final objective?, If you describe it with more detail we could offer you a better solution.
From what i understand, you should see yourself what type of file the user is trying to open, and then yourself open it with the most suitable one.
Since you cant really emulate what apple is doing, you should handle this problem through your interface, offer the user to "share" or to "open with" for example.
The answer is very simple. There is no way to do it. You cannot add the apps except the defaults into the UIActivityViewControllers.
You are absolutley correct, you can acheive this through the UIDocumentInteractionController.

Putting a url in an email that opens an application on iPhone or iPad

I know what code is needed to cause my iOS app to open a link in Safari. But I am looking at how I might accomplish something more in the reverse direction.
I can send email from my app. I would like to include a link in the email, that, when clicked on within the email on my iPhone or iPad, will open my app and perform an action based on the property values passed in the link. (The link would refer to a record in the database of my app, so the app can provide a view content based on that record.)
Another example I have seen is the special purpose URL used in the manifest file that loads ad hoc distributions over the air.
I see something like this when places and dates are automatically converted to links that open the map or calendar applications.
Does anyone have an idea how I can do this?
You need to implement a custom URL scheme.

Resources