Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9154637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:27:31+00:00 2026-06-17T12:27:31+00:00

This method opens up the url in Safari when the website string is not

  • 0

This method opens up the url in Safari when the website string is not null and it is atleast of length 3. But when I have supplierWebsite=@”www.heritage.com”, nothing happens. I know that heritage.com is not valid website and so it is not activating in UIApplication. I would like to display atleast a pop up that would tell user that website is not available. Is there any way i can show Alertview telling that website is not available.

- (IBAction)doWebOpen:(UIButton *)sender {

if (self.provider.supplierWebSite && [self.provider.supplierWebSite length] > 3) {
    NSString *urlString = [self.provider supplierWebSite];
    NSURL *url = [NSURL URLWithString:urlString];
    [[UIApplication sharedApplication] openURL:url];

}else {

    NSError *err = [NSError errorWithDomain:@"com.cantopenweb" code:509 andDescription:@"This supplier does not have a website."];
    [self showErrorAlert:err];
}}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:27:33+00:00Added an answer on June 17, 2026 at 12:27 pm

    Just use canOpenURL of UIApplication class, like:

    if([[UIApplication sharedApplication] canOpenURL:url])
     {
        [[UIApplication sharedApplication] openURL:url];
     }
     else
     {
       //show alert
     }
    

    canOpenURL:

    Returns whether an application can open a given URL resource.

    - (BOOL)canOpenURL:(NSURL *)url

    Parameters

    url

    A URL object that identifies a given resource. The URL’s scheme—possibly a custom scheme—identifies which application can
    

    handle the URL.

    Return Value

    NO if no application is available that will accept the URL; otherwise,
    returns YES. Discussion

    This method guarantees that that if openURL: is called, another
    application will be launched to handle it. It does not guarantee that
    the full URL is valid. Availability

    Available in iOS 3.0 and later.
    

    Declared In UIApplication.h

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dialog box in mvc that opens up first time but not
I have gwt java code program that opens up a window with url. Map<String,
I have this code in my viewWillAppear method: sqlite3 *database; if (sqlite3_open([[self dataFilePath] UTF8String],
I have this code: s(x => x.Open()); s is a method which calls one
This method that draws my tiles seems to be quite slow, Im not sure
This method is working totally right in matlab. but, when I compiled it in
I'd like to launch a URL in Safari from UIView sending POST datas. This
I am getting a POST https://www.example.com/php/download.php 405 (Not Allowed) with this ajax call to
This Javascript that I found here adds a method parseURL() to the string object
I have a link with this listener: $('#share-via-facebook-trigger').click(function () { FB.ui( { method: 'stream.publish',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.