iOS when I click on an Associated Domain within my own app, safari is launched instead - ios

I have an associated domain. If I click on a link to that domain from anywhere outside my app, the app is launched.
If I click on it inside my app, safari is launched instead.
Why is this happening? Can I prevent it?

In AppDelegate method
Intercept links from openURL and links from other components like UITextView - present custom alert and on the alert delegate either cancel or redirect to the link

Related

ApplicationShortcuts, is there any way to not open the app and only execute some actions such as Play/Pause?

I have an audio app and I want to control play/pause with ApplicationShortcutItem directly, but I don't want to open the app.
Is it possible?
It is not possible to leave an app in the background when choosing a Home screen quick action.
From the documentation of UIApplicationShortcutItem:
When a user chooses one of your Home screen quick actions, the system launches or resumes your app and UIKit calls the application(_:performActionFor:completionHandler:) method in your app delegate.

Performing a task through a website and going back to an iOS app

I'm developing an iOS 7+ app that I need to offer the option of navigating to a certain web page to let the users to fill in a form there, and after that to come back to the app's view where the user was.
Is it possible to programmatically open Safari with a given url? If it is, I suppose that then there is no way to automatically redirect the user to your app from there... right? Is then a UIWebView the only option? Is it possible to navigate back or dismiss the view with the UIWebView without the need of user interaction?
Thanks
You can open links in Safari as detailed in this post How to launch safari and open URL from iOS app
I don't believe you can set a 'callback' and have it return to your app on completion, as you have no control over the user once they have exited your app's sandbox.
Opening the link in UIWebView would provide control, as you can utilize the UIWebView callbacks.

When implementing AppLinks, the Facebook app creates a special button on the status bar and the app doesn't open up directly

I have added the meta tags in the webpage and I am using the method application:openURL:sourceApplication:annotation: to handle the incoming links, but my app doesn't open up directly. The user has to click on that special button on the status bar in the Facebook's browser in order to open the app.
Please help!

Is it allowed to add a UITabBarItem that opens up Safari?

I want to add a UITabBarItem on the TabBar which when clicked opens up Safari instead of loading its corresponding tab. (Not UIWebView but the app goes to background and opens up Safari instead)
I already know how to do this, but I was wondering if this is allowed by Apple. I know they're OK with using the TabBarItem to trigger other actions such as opening a modal in the app, etc. However I am not sure if it's OK to open a safari.
I am just being cautious because I don't want it to get rejected for this and wait another week.
I don't see a reason why it shouldn't be allowed.
But: it could lead to confusion amongst your users, because they would most likely not expect that touching an item on the TabBar leads to an app switch. I would rather open a webView and offer the additional possibility to open the page in Safari.
There is no harm doing such and it is also allowed by Apple.
But, I would personally suggest to use UIWebView, over Safari navigation. Because it will create unhealthy user experience, where he/she requires to jump around to swith in-between Safari and App. Rather you can open the same link in UIWebView, which will kepp our user in app only.

Is it possible to navigate back to the starting point when external links are clicked in a UIWebView?

I've put together a very simple proof of concept app using a UIWebView (and a regular controller) to display a web page.
If the web page has external links then when clicked on the app will switch to the web app.
However there's no way to get back to my original app.
If I add a navigation controller will I get the ability to navigate back, or is there something else additionally that would be required?
(As well as launching web pages it will also be necessary to intercept custom links in the web page and perform some associated action, such as add a contact, in this situation I would also like to be able to navigate back to my app).
TIA
If your links open in Safari, the only way for your user to get back to your app is via the multitasking bar (or obviously quitting and tapping on your app icon)- there is no way to bring your app to the forefront programmatically from within another app.
I am confused though, if you have a UIWebView, the default behavior of clicking on links is to load the linked page in the same web view.
In any case, I think what you are wondering is how to intercept link clicks of a UIWebView so to do that, you should implement the delegate method:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
You can then test for clicked links via testing the navigationType property for UIWebViewNavigationTypeLinkClicked

Resources