Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Discover all end points supported by UIActivityViewController like WeChat, KaKao, Line, and others?

This SO post addresses how to customize the UIActivityViewController by excluding services like AirDrop or printing.

It also mentions this Apple doc which highlights the stock services supported, but how do we identify other supported end points like Line and other messaging apps?

Specifically:

(1) Do Skype, Kakao, Line, Viber, WeChat, Kik, WhatsApp, and Facebook Messenger (not Facebook proper) have end points?

(2) What are those end points?

like image 920
Crashalot Avatar asked Jul 23 '14 00:07

Crashalot


1 Answers

You can't do that currently on iOS 7, because no application can talk directly to other applications yet for security reasons. One of the highlights of the last WWDC was the introduction of extensions for iOS 8, which will make this possible; you can read how in the Creating Action Extensions example.

There are however attempts at fixing this. A notable example is IntentKit, which works by having a repository of known apps.

What is IntentKit?

IntentKit is an open-source iOS library that makes it easier to link to other apps. It's sort of like Android's Intents or Windows Phone's Contracts.

Another example of one of such attempts is OvershareKit

Why OvershareKit?

Sharing is far too cumbersome to implement on iOS. UIActivityViewController is too limiting, and rolling your own library is too time-consuming. Most devs end up settling for underwhelming sharing options for lack of the time or inclination to make something better.

OvershareKit makes it trivial to add rich sharing options to your iOS apps.

How to know if an application is installed?

Even though you can't discover them. If you know the application you're looking for and what kind of URL Scheme it responds to, then you can check if your app is able to open that kind of URL.

That's what IntentKit is for, it's a repository of knowledge about applications, the URL Schemes they respond to and the kind of actions they can perform. With the introduction of extensions.

For example, you can check if Facebook is installed by checking if you can open a fb:// URL.

BOOL isFacebookInstalled = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]];

About IntentKit's inner workings

Internally, IntentKit will check for that same thing, as you can see in INKActivity's implementation:

- (BOOL)canPerformCommand:(NSString *)command {
    if (!self.actions[command]) { return NO; }

    if (self.presenter) {
        return [self.presenter canPerformAction:command];
    } else {
        NSURL *url = [NSURL URLWithString:[self.actions[command] urlScheme]];
        return [self.application canOpenURL:url];
    }
}

Info about requested UIActivity services:

  • Skype uses the "skype:" URI, more info in the official documentation
  • Kakao & Line, with DCActivity (there seems to be an official API for Kakao, but the documentation is in korean)
  • Line, with LINEActivity
  • WeChat, with WeixinActivity (there's also an official API with which you can make your own UIActivity)
  • WhatsApp uses the "whatsapp:" URI, more info on the official FAQ, there are also various UIActivity implementations for WhatsApp, take a look at them in cocoapods.com
  • Facebook Messenger uses the "fb-messenger:" URI, more info in this other answer by tia, also see workarounds.
  • Kik has a public API, but no SDK nor UIActivity implementation that I know of. Also, see workarounds.
  • Viber has no SDK nor public API, see workarounds.

Workarounds

Most of these services are based on known protocols, or slight variations of them. For example, you can use XMPP (aka Jabber) to directly send messages to a Facebook IM or Kik account; some people say that Viber seems to use a modification of SIP for signaling with VoIP phones. So you could work around some SDK/API limitations by using the underlying mechanisms.


SDK or API?

If all you need is to send a message to those services, I'd argue that you don't really need to communicate with the installed application via an SDK or URL Schemes, I haven't been able to test the Big Emoji app you mentioned, as it just crashes on iOS 8, but if it's using the services API's, you could easily work it out by using Charles or Wireshark.

like image 179
NiñoScript Avatar answered Oct 23 '22 05:10

NiñoScript