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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:54:02+00:00 2026-06-01T10:54:02+00:00

My app crashed when i trying to change UITextView text. Here is the code:

  • 0

My app crashed when i trying to change UITextView text.

Here is the code: (header file):

//
#import <UIKit/UIKit.h>

@interface DetailViewController : UIViewController {

    IBOutlet UIImageView *appImage;
    IBOutlet UILabel *appName;
    IBOutlet UILabel *appDeveloper;
    IBOutlet UILabel *appVersion;
    UIActivityIndicatorView *loading;
    IBOutlet UITextView *appAbout;
    NSString *selectedApp;

}

@property (nonatomic, retain) NSString *selectedApp;
@property (nonatomic, retain) IBOutlet UIImageView *appImage;
@property (nonatomic, retain) IBOutlet UILabel *appName;
@property (nonatomic, retain) IBOutlet UILabel *appDeveloper;
@property (nonatomic, retain) IBOutlet UILabel *appVersion;
@property (nonatomic, retain) UIActivityIndicatorView *loading;
@property (nonatomic, retain) UITextView *appAbout;

@end

implementation file:

- (void)loadData {

    NSString *trimmedString = [selectedApp stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
    self.navigationItem.title = @"Info";
    NSLog(@"%@", trimmedString);
    NSString *website = [NSString stringWithFormat:@"http://shaymargolisapps.x10.mx/send.php?mission=GetNameOfApps&aname=%@", trimmedString]; 
    NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:website]];
    NSString *strResult = [[[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding]autorelease];
    appName.text = strResult;
    NSString *website1 = [NSString stringWithFormat:@"http://shaymargolisapps.x10.mx/send.php?mission=GetDeveloperOfApp&aname=%@", trimmedString]; 
    NSData *dataURL1 = [NSData dataWithContentsOfURL:[NSURL URLWithString:website1]];
    NSString *strResult1 = [[[NSString alloc] initWithData:dataURL1 encoding:NSUTF8StringEncoding]autorelease];
    appDeveloper.text = strResult1;
    NSString *website2 = [NSString stringWithFormat:@"http://shaymargolisapps.x10.mx/send.php?mission=GetVersionOfApp&aname=%@", trimmedString]; 
    NSData *dataURL2 = [NSData dataWithContentsOfURL:[NSURL URLWithString:website2]];
    NSString *strResult2 = [[[NSString alloc] initWithData:dataURL2 encoding:NSUTF8StringEncoding]autorelease];
    appVersion.text = strResult2;
    NSString *website3 = [NSString stringWithFormat:@"http://shaymargolisapps.x10.mx/send.php?mission=GetInfoOfApp&aname=%@", trimmedString];
    NSData *dataURL3 = [NSData dataWithContentsOfURL:[NSURL URLWithString:website3]];
    NSString *strResult3 = [[[NSString alloc] initWithData:dataURL3 encoding:NSUTF8StringEncoding]autorelease];
    NSLog(@"%@", strResult3);
    **appAbout.text = strResult3;**
    NSString *website4 = [NSString stringWithFormat:@"http://shaymargolisapps.x10.mx/send.php?mission=GetImageOfApp&aname=%@", trimmedString];
    NSData *dataURL4 = [NSData dataWithContentsOfURL:[NSURL URLWithString:website4]];
    NSString *strResult4 = [[[NSString alloc] initWithData:dataURL4 encoding:NSUTF8StringEncoding]autorelease];
    NSData* imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:strResult4]];
    UIImage* image = [[UIImage alloc] initWithData:imageData];
    [appImage setImage:image];
    [image release];
    [imageData release];
    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
    [loading stopAnimating];
    [loading setHidden:YES];
    [appName setHidden:NO];
    [appDeveloper setHidden:NO];
    [appVersion setHidden:NO];
    [appImage setHidden:NO];
    [appAbout setHidden:NO];

}

My app crashed on appAbout.text = strResult3; line. What am I doing wrong?

loadData is called with [self performSelectorInBackground:@selector(loadData) withObject:nil]; from viewDidLoad

(Xcode 4.4 DP2, iPhone Simulator 5.1, base SDK 4.3)

  • 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-01T10:54:04+00:00Added an answer on June 1, 2026 at 10:54 am

    You must not change UI* objects from a background thread. That has to be done from the main thread.

    You could use gcd to perform the changes on the main thread. Something like this:

    /* ... */
    NSString *strResult4 = [[[NSString alloc] initWithData:dataURL4 encoding:NSUTF8StringEncoding]autorelease];
    NSData* imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:strResult4]];
    UIImage* image = [[UIImage alloc] initWithData:imageData];
    
    dispatch_async(dispatch_get_main_queue(), ^{
        self.navigationItem.title = @"Info";
        appName.text = strResult;
        appDeveloper.text = strResult1;
        appVersion.text = strResult2;
        appAbout.text = strResult3;
        [appImage setImage:image];
        [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
        [loading stopAnimating];
        [loading setHidden:YES];
        [appName setHidden:NO];
        [appDeveloper setHidden:NO];
        [appVersion setHidden:NO];
        [appImage setHidden:NO];
        [appAbout setHidden:NO];
    });
    
    [image release];
    [imageData release];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to include plCrashReporter in my iPhone app using the code found here:
When I am trying to release the object of UIPopoverController ,app gets crashed with
I'm trying to figure out why my app crashed, my slug size is very
I'm trying to change the drop shadow of the text in a button and
I'm trying to refactor my sinatra code to separate my main file into separate
I'm trying to switch views in my app using this chunk of code: self->variable1
When trying to authenticate with facebook, my app crashes. It reaches the line new
Someone emailed me today that my app crashed on their device. I could not
I spent a lot of time to find out why my app crashed. My
I'm trying to download all png files contained in an html file. I have

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.