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 8200841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:35:27+00:00 2026-06-07T06:35:27+00:00

my app crashed when nsstring getting contents of URL. website = [NSString stringWithFormat:@hidden.]; contents

  • 0

my app crashed when nsstring getting contents of URL.

website = [NSString stringWithFormat:@"hidden."]; 
contents = [NSString stringWithContentsOfURL:[NSURL URLWithString:website] encoding:NSUTF8StringEncoding error:nil];

the crash log is:

void _WebThreadLockFromAnyThread(bool), 0x865cc40: Obtaining the web lock from a thread other than the main thread or the web thread. UIKit should not be called from a secondary thread.
2012-07-10 11:15:17.654 MyApplication[1505:19407] OK // some output
2012-07-10 11:15:17.660 MyApplication[1505:19407] bool _WebTryThreadLock(bool), 0x865cc40: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...
1   WebThreadLock
2   -[UITextRangeImpl isEmpty]
3   -[UITextRange(UITextSelectionAdditions) _isCaret]
4   -[UITextSelectionView setCaretBlinks:]
5   -[UIKeyboardImpl setCaretBlinks:]
6   -[UIKeyboardImpl setDelegate:force:]
7   -[UIKeyboardImpl setDelegate:]
8   -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:]
9   -[UIResponder(UIResponderInputViewAdditions) reloadInputViews]
10  -[UIResponder(Internal) _windowBecameKey]
11  -[UITextField _windowBecameKey]
12  -[UIWindow makeKeyWindow]
13  -[UIWindow makeKeyAndVisible]
14  -[MyApplicationAppDelegate checkLogin]
15  -[NSThread main]
16  __NSThread__main__
17  _pthread_start
18  thread_start

the code is called with [self performSelectorInBackground:@selector(checkLogin) withObject:nil]; from IBAction. what i am doing wrong?

(Xcode 4.3, Mac OS X Lion, iPhone Simulator 5.1)

  • 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-07T06:35:30+00:00Added an answer on June 7, 2026 at 6:35 am

    According to that error message, you’re trying to update a UIKit object from a background thread, and the UI can only be updated from the main thread.

    Instead, use self performSelectorOnMainThread to call back to the main thread to update your UI with whatever information you received when your web call returns.

    From your main thread:

    [self performSelectorInBackground:@selector(checkLogin) withObject:nil];
    

    In the background:

    - (void)checkLogin {
        // Do web stuff
        ...
    
        [self performSelectorOnMainThread:@selector(updateUI) 
                               withObject:nil 
                            waitUntilDone:NO];
    }
    
    - (void)updateUI {
        [statusLabel setText:@"Done!"];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

-(void)loadWebAdress:(NSString*)textAdress { [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; adressurl=[NSString stringWithFormat:@http://%@, textAdress]; NSURL *url=[NSURL URLWithString:adressurl]; NSURLRequest *requestObj=[NSURLRequest
I keep getting the following error: *** Terminating app due to uncaught exception 'NSInvalidArgumentException',
i'm getting an _WebThreadLockFromAnyThread error in my app. it doesn't crash my app (every
My app crashed when i trying to change UITextView text. Here is the code:
I spent a lot of time to find out why my app crashed. My
That's what Apple said - the app got crashed for them against iPad 3,
When I am trying to release the object of UIPopoverController ,app gets crashed with
I would like for my app to reset to standard settings if it crashed
My app crashes several times without any error or stack trace on my console.
Why doesn't @try block work? It crashed the app, but it was supposed to

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.