chevron-up bell reply instagram twitter2 feed3 finder search-25px-p0

Use default iOS URL Schemes

2016-01-22
// Make a phone call
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:12125551212"]];

// Open an url using default brower Safari
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.arkilis.me"]]

// Send an email by calling Email app
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto:arkilis@gmail.com"]];

// Send a SMS
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:0400000000"

// Make a phone call
UIApplication.shared.openURL(URL(string: "tel:12125551212")!)

// Open an url using default brower Safari
UIApplication.shared.openURL(URL(string: "http://www.arkilis.me")!)

// Send an email by calling Email app
UIApplication.shared.openURL(URL(string: "mailto:arkilis@gmail.com")!)

// Send a SMS
UIApplication.shared.openURL(URL(string: "sms:0400000000")!)

Be careful about above methods which will be deprecated in iOS 10. In stead, iOS 10 provides a new method called:

- (void)openURL:(NSURL *)url 
        options:(NSDictionary<NSString *,id> *)options 
completionHandler:(void (^)(BOOL success))completion;

func open(_ url: URL, 
  options: [String : Any] = [:], 
completionHandler completion: ((Bool) -> Void)? = nil)

Reference:

https://developer.apple.com/reference/uikit/uiapplication/1648685-open

arkilis

Make Your Comments