Is there an alternative to (the deprecated) canOpenURL in iOS 9? - objective-c

I am using apple's canOpenURL: and openURL: methods to detect & open other application. But as these methods are deprecated in iOS9, They returns NO.
Is there any alternate to manage this?
Thanks

You need to provide "whitelist" to your plist
<key>LSApplicationQueriesSchemes</key>
<array>
<string>urlscheme</string>
<string>urlscheme2</string>
<string>urlscheme3</string>
<string>urlscheme4</string>
</array>
See for more details
iOS 9 has made a small change to the handling of URL scheme.
More details

Here you can find some information.
as the article said:
Up until iOS 9, apps have been able to call these methods on any arbitrary URLs. Starting on iOS 9, apps will have to declare what URL schemes they would like to be able to check for and open in the configuration files of the app as it is submitted to Apple. This is essentially a whitelist that can only be changed or added to by submitting an update to Apple. It appears that certain common URLs handled by system apps, like “http”, “https”, do not need to be explicitly whitelisted.
In short: Apple wants to prevent apps from being able to scan a user's device and know which apps are installed
So to answer to your question: actually there is no solution, because apple want exactly to prevent this kind of behaviour

In some contexts, if you need to open arbitrary deeplinks, the Universal App Links can be a solution: you point to the website of the app (which needs to implement this behaviour) and iOS 9 will automatically deeplink to the adhoc app.

Related

Branch.io smart banner how detect open or download app

I'd like to use branch smart banner because it can open app if it was installed. But i've understood how it work. I need install ios sdk in my app and use setIdentity?
Alex from Branch.io here: the smart banner actually doesn't require the SDK to be integrated. setIdentity is a completely separate method used for tracking individual users, and isn't used at all for the smart banner.
However, integrating the SDK is definitely the easiest way to get things working, because even without it you would still need to set up a Branch account, configure all your link routing rules in the Branch dashboard, and then enable Universal Links in your app (if it's iOS). Since that is 90% of the SDK set up process, you might as well do the whole thing so you can also take advantage of things like install attribution and analytics!

objective-c method to open an app already installed

I've created an iPhone app in objective-c with Xcode 5. It's a simple redirect to an app on AppStore via button (UIbutton and its IBAction). Can I open directly this app if it's already installed on iOS? Because in spite of this app is already available on iPhone it's carry on to open it via AppStore!
If it is your app, or you know it well and it has a custom url scheme, you may use Application::canOpenUrl: (link) to check for its existence and Application::openUrl: to launch the application.
This will not be possible for third party applications that do not have, or of which you don't know a custom url scheme.
you need to use URL schemes, a method for sending and receiving data between applications.
A physical device is required for testing this app.look at this example .sample example
try this example . if you face any issue let me know about that.
Yeah! Problem solved...I had to use only URL Scheme of the App I want to open, and insert inside openurl method, -> https://stackoverflow.com/a/24033837/3706995

Can I add a link on my iphone settings app like Facebook and Twitter?

I defined the Root.plist for my iPhone app, but I would like to include a link like the Twitter and Facebook apps have in the settings. Is this possible? I couldn't find any type that would allow me to do that on Apple's dpcumentation.
There is no way to do that, between, you can make your settings inside your app instead of being in the settings.app, This kit may help you: InAppSettingsKit

iOS App URL is not being detected

I have created a custom App URL for my iOS app. The URL format is similar to this:
myappname://texttobeparsed
This works fine when I paste the URL in safari, My App opens and correctly handles the URL. The problem is that other apps such as iMessage or Notes do not recognize this as a URL.
Why isn't this URL scheme being recognized as a URL? Could it have to do with how I set it up in my info.plist file or something else?
Or, does the URL need to be in a different format to be recognized?
I know it's possible to have the system recognize it as a URL in apps other than web-browsers because I've seen it before with other apps (ex. iTunes: itms://itunes.com/apps/appname or Twitter: twitter:// or Facebook: fb://).
There's nothing you can do about this. If the link isn't explicit (e.g. in an HTML email), these apps can just recognize a built-in set of standard URL schemes. itms:// is one of Apple's own schemes (for the iTunes Store), so it makes sense that it is supported in addition to the standard mailto://, http://, tel://... schemes.
Edit: I would guess that the information that is used to determine what constitutes a valid URL in text views etc. is cached somehow. Contrary to what I initially guessed, it seems that app-specific URLs do work in Notes, etc. I've tested this with tweetbot:// for example (which I have installed) and twitter:// (which I don't have installed) to verify that it doesn't just check for a pattern like *://, but actually uses information about the installed apps.
I'd suggest that you try to restart your device. If it's an issue with some cache, that might help and I don't think there's much else you could do if your URL scheme already works in Safari.
Update: I've installed the official Twitter app to test this, the twitter:// scheme wasn't immediately recognized in Notes, but after killing and restarting the Notes app, it worked.
Update 2: I've done a minimal test app with myappname:// as a custom URL scheme. Again, like with the Twitter app, it worked after restarting the Notes app, so it doesn't seem related to the popularity of the app or whether it's been submitted or not.
I can't answer as to why it's not working (beyond guessing that the link interpreter is hard-coded to only recognize certain URL schemes), but I can say that the typical way around this is to link to a web page, and have the web page redirect to your custom scheme.
It's slightly less elegant, because the user will see Safari open up briefly before being forwarded to your app, but it's also more robust because the web page can provide a link to the app store to install the app if it is not installed on the user's phone.

Getting info on other apps via Objective-C

Is it possible via objective-c to find information (such as the names) for other apps installed on an iPhone from my app?
If you mean a "legal" way to do this and get the app in the AppStore, then no, Apple does not provide such an API. And they probably never will, because this will go against the users' privacy.