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

  • SEARCH
  • Home
  • 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 4123502
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:37:10+00:00 2026-05-20T23:37:10+00:00

I have a variable called storedURL which is in the format www.xxxxx.com . I

  • 0

I have a variable called storedURL which is in the format www.xxxxx.com. I am trying to use the below code to open this URL in Safari when a user clicks a button.

-(IBAction)launchWeb {

    NSString *url = [NSString stringWithFormat: @"%@",
                     storedURL];

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];  
}

However the app crashes when the button is clicked.

Can anyone help correct my code ?

EDIT

mvds’ code crashes with following :

2011-04-02 14:01:41.542 London[16791:207] +[NSURL urlWithString:]: unrecognized selector sent to class 0x103dcbc
2011-04-02 14:01:41.545 London[16791:207] * Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘+[NSURL urlWithString:]: unrecognized selector sent to class 0x103dcbc’
*
Call stack at first throw:
(
0 CoreFoundation 0x00fd95a9 exceptionPreprocess + 185
1 libobjc.A.dylib 0x0112d313 objc_exception_throw + 44
2 CoreFoundation 0x00fdb17b +[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00f4a966 __forwarding
+ 966
4 CoreFoundation 0x00f4a522 _CF_forwarding_prep_0 + 50
5 London 0x00006bce -[DetailViewController launchWeb] + 126
6 UIKit 0x0022b4fd -[UIApplication sendAction:to:from:forEvent:] + 119
7 UIKit 0x002bb799 -[UIControl sendAction:to:forEvent:] + 67
8 UIKit 0x002bdc2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
9 UIKit 0x002bc7d8 -[UIControl touchesEnded:withEvent:] + 458
10 UIKit 0x004be4de _UIGestureRecognizerSortAndSendDelayedTouches + 3609
11 UIKit 0x004bec53 _UIGestureRecognizerUpdateObserver + 927
12 CoreFoundation 0x00fba89b CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 27
13 CoreFoundation 0x00f4f6e7 __CFRunLoopDoObservers + 295
14 CoreFoundation 0x00f181d7 __CFRunLoopRun + 1575
15 CoreFoundation 0x00f17840 CFRunLoopRunSpecific + 208
16 CoreFoundation 0x00f17761 CFRunLoopRunInMode + 97
17 GraphicsServices 0x0151a1c4 GSEventRunModal + 217
18 GraphicsServices 0x0151a289 GSEventRun + 115
19 UIKit 0x00239c93 UIApplicationMain + 1160
20 London 0x00001ee9 main + 121
21 London 0x00001e65 start + 53

  • 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-05-20T23:37:11+00:00Added an answer on May 20, 2026 at 11:37 pm

    The URL is probably nil, since “www.xxxxxxx.com” is not a url. Try

     NSString *urlstring = [NSString stringWithFormat:@"http://%@/",storedURL];
     NSURL *url = [NSURL URLWithString:urlstring];
     NSLog(@"url = %@",url);
     [[UIApplication sharedApplication] openURL:url];
    

    If this doesn’t help, please share the output (stack trace) given in the console window.

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

Sidebar

Related Questions

I have a variable called @status which I set before this select statement: Select
I have an environment variable called $TEST which refers to a directory in my
I have a variable called root. The value for this variable is 0 $root
I have a huge dictionary of blank values in a variable called current like
I have a paragraph of text in a javascript variable called 'input_content' and that
I have a variable that contains a 4 byte, network-order IPv4 address (this was
I have a variable of type Hashmap <String,Integer >. In this, the Integer value
I have a variable called c_kilometers. I have a cursor that grabs a bunch
I have a variable called account_type passed from a rails form and need to
I have a variable called STATIC_URL, declared in settings.py in my base project: STATIC_URL

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.