Launching Safari App without using any specific url from an iOS App
Actually we can open a specific app from safari. You have to create a custom url scheme for the application and open that link from safari like any other link is opened from safari.
Create a custom url scheme like
myApp://
Then open it from safari e.g on onClick of button.
Open url and stay in app
The example your are showing is using the SFSafariViewController
. This will show Safari in your app, this class is available in iOS 9 or newer.
You could use a check like this if you plan to support versions lower then iOS 9:
if ([SFSafariViewController class]) {
SFSafariViewController *viewController = [[SFSafariViewController alloc] initWithURL:url];
[self presentViewController:viewController animated:YES completion:nil];
} else {
WebViewController *viewController = [[WebViewController alloc] init];
viewController.url = url;
[self presentNavigationControllerWithViewController:viewController animated:YES completion:nil];
}
Here WebViewController
is just a view controller with a UIWebView
that will load the page. You can create your own tool bar like SFSafariViewController
to go back/forward or open in Safari.
Related Topics
Xcode, Where to Assign the Segue Identifier
What Are Sprite Kit'S "Category Mask" and "Collision Mask"
Using Nsuserdefaults on Arrays
How to Validate an E-Mail Address in Swift
Uisplitviewcontroller in Portrait on Iphone Shows Detail Vc Instead of Master
How to Play a Local Video With Swift
Shouldautorotatetointerfaceorientation Not Being Called in iOS 6
How to Add Image and Text in Uitextview in Ios
In Ios13 the Status Bar Background Colour Is Different from the Navigation Bar in Large Text Mode
Replacement For Deprecated -Sizewithfont:Constrainedtosize:Linebreakmode: in iOS 7
Run App For More Than 10 Minutes in Background
Iphone App in Landscape Mode, 2008 Systems
Swift Native Functions to Have Numbers as Hex Strings
Navigation Controller Push View Controller
Watchkit Extension - No Matching Provisioning Profiles Found