How to check if my other apps are installed on iOS 10? - ios

Until iOS 9, we were able to use canOpenURL method to check if there are apps who can handle specific URL schemes, thus it was widely used to check if a specific app was installed by user.
Now, since iOS 9, we have to declare upfront the URL Schemes that can be checked by the app. This is cool in general, but it means that for every release of a new app, we would have to update previous apps to be able to check if the new one is installed or not.
Is there any sane way to do it now?
I guess most of the ads and cross promotion services out there relies on this and had to adapt somehow, anyone knows how?
Thanks
Krystian

Ok, so to recap.
Currently, the only way to handle my scenario, is to assign a specific scheme per app in an orderly fashion, for example:
my.domain.app01
my.domain.app02
...
If you have apps already released, just update them to add a new, additional scheme.
Now in Info.plist file, you will have to add all of your existing and future schemes to LSApplicationQueriesSchemes list in Info.plist.
The idea is: even though you have 10 apps released, you add entries for let's say 40. This way, you will not have to update your app to add schemes for future apps, they will already be there and you will be able to detect them.
This of course covers my scenario, where I want to be able to detect my own apps and make use of them.
Remember, that your app can handle more than one scheme, so you can assign the internal scheme + use something better named to allow external access to your app.

Related

How updating dynamic framework will affect App Store build

I have an app on the App Store and I have to create another app. This other app has some of the same functionalities as the first app. So I wanted to create a framework to put the common code in and use it inside the apps. Unfortunately, this framework has to change to add more features and improvements.
I saw that dynamic libraries can update the library code without any change to an app already pushed to the App Store. But this is reserved for Apple. Also, since iOS 8, we can create a dynamic framework which includes dynamic libraries. So is it possible to have the same, meaning if I update my dynamic framework, it also updates the app without having to push to the App Store again and face app review process?
If not, do you have some clues/recommendation to achieve that?
Dynamic Framework is a bit different from the understanding you have. Please read apple documents in more detail for that.
Currently only way to achieve what you expect is to push code on App Store as hidden, and based on some server API configuration update your content accordingly (Firebase Remote Config is one such good example if security is not that big a concern)

Check installed apps version

We have multiple apps in place for a company. Now we would like to write an 'Overview App' which should list all apps, differentiate between installed and not installed.
This can be achieved with an URL-Scheme, but:
We also want to check, if the latest version of each app is installed.
I first thought of using two schemes, one to check if the app is installed and a second with the version/bundle in the URL to check if it is the correct version.
What I found out yet:
As of iOS 9, third party applications are no longer able to query arbitrary URL schemes.
Info.plist Schemes cannot be edited on runtime
This will therefore not work in my opinion (Only if the overview app is updated with the new version scheme everytime one of the apps within is updated). The only alternative I could think of would be to implement a pod in each app which will on app start post the installed version/bundle with the device-id in an overview table which can then be accessed by the 'Overview App'.
This would be my very last solution if nothing else works, any inputs if I missed anything (with URL-Scheme, like Callback or something, or an other way) are highly appreciated.

Long list of domains in iOS Entitlement file in iOS 9.0-9.2

We have a need to support 100+ domains in our entitlements file for Universal Links.
Example:
applinks:test.myapp.com
applinks:blah.myapp.com
applinks:foo.bar.com
etc...
I know that *.myapp.com will be supported in iOS 9.3, but is there a way to do this elegantly for customers using iOS 9.0 to 9.2 without having to manually add 100+ entries to the entitlements file? Is there a way to do this without having to rebuild and re-release our app every time we need to add a domain to the list?
Thanks!
The new wildcard support in iOS 9.3 is designed for exactly the situation you're describing, so there isn't really a solid alternative in earlier OS versions.
If you don't want to worry about continually updating the list of subdomain applinks entries (or even if you do, but need to wait for App Store review), the best workaround is probably hosting fallback pages on each subdomain with a call-to-action the user can use to continue into the app. That would work as follows:
Assume that you have applinks:mydomain.com configured.
User opens a link to new.mydomain.com/exciting-page (which is NOT covered by the entitlement above).
User sees a custom interstitial, functionally similar to something like this. On this interstitial is a link pointing to mydomain.com/new/exciting-page
User opens the link and the app launches.
The only thing I am not sure about is whether mydomain.com and new.mydomain.com count as 'different domains' for the purpose of Universal Links, since Universal Linking functionality is disabled in Safari for links within the same domain (source). If this turns out not to work, you could easily use something like applinks:mydomain.io and a link to mydomain.io/new/exciting-page in step 3 instead.

How can I make my iOS apps talk to each other?

I’ve got several iOS apps and I need them to be aware of each other. More precisely, I need to know whether there’s already one of my apps installed.
I thought about registering a custom URL scheme (something like my-app-present://), so that I could check whether the custom scheme is supported and if yes, I would know there’s already one of my apps on the device. But that doesn’t work, because the schemes are registered through Info.plist and the app registers the scheme before it has a chance to check for its existence. In other words, the check always succeeds.
Then I thought about creating a file in the temporary directory, but NSTemporaryDirectory() returns a folder inside the application sandbox, so that wouldn’t work either. I also thought about keychain, but again it looks like each application has strictly separate keychain on iOS.
I don’t want to go through the list of running apps and I don’t want to use networking. Do you know some other tricks?
The custom URL scheme method sounds fine, as long as you have a different scheme for every app, for example my-app-1:// and my-app-2://. Then (I assume this is what you already knew) you can use canOpenURL: to check if the URL can be handled (i.e., your app is installed).
If by "talk to each other" you meant you just want to detect whether other app has been installed or not then iHasApp is an open source iOS framework could come in handy. I haven't used it yet. but from the description it appears to be a good choice.
http://www.ihasapp.com/documentation/Classes/iHasApp.html

How iOS handle URL scheme duplication?

If 2 other app register same url scheme, how iOS handle this?
The iOS Documentation reads:
Note: If more than one third-party app registers to handle the same URL scheme, there is currently no process for determining which app will be given that scheme.
The OSs behaviour is undefined if there are two apps registered for an URL scheme, therefore you should try to define a handler that is specific for your app to avoid this situation (e.g. awesomeMapsApp:// instead of maps://).
Actually it can be really problematic. For example, til' March 2016, an app called Grabb handles PayPal schemes so that if your app tries to open PayPal (with all the security nonce etc. within the call) it launches Grabb instead, and you can do nothing about it. Even with the openURL alertView added in iOS 9, it can still be a big security issue.
Here is what I have tested:
iOS 5: the first installed app will be chosen. If you delete first installed app, then the others will not launch unless you install again.
iOS 6: the lastest installed app will be chosen. If you delete the lastest installed app, then the previous installed app will be chosen.
It will present an UIActionSheet view allowing the user to choose which app to launch (good example are apps that handle .doc files). That's where the icon you specify is used - on the action sheet buttons when it's shown to the user

Resources