Индикатор активности загружает изображение из-за сбоя URL - PullRequest
0 голосов
/ 29 марта 2012

Это происходит сбой при возврате UIApplicationMain (argc, argv, nil, NSStringFromClass ([AppDelegate class]));и говорит SIGABRT Какие-нибудь идеи, что происходит и как это исправить?

Раньше это работало для меня ... конечно, это было до ARC и некоторое время назад в версиях xcode.Спасибо.

-(IBAction)forward:(id)sender
{
    [self->active removeFromSuperview];
    // Assign activity indicator to the pre-defined property (so it can be removed when image loaded
    self->active =  [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(195, 425, 25, 25)];    

    // Start it animating and add it to the view  
    [self->active startAnimating];  
    [self.view addSubview:self->active]; 

    [self performSelectorInBackground:@selector(loadImageInBackgroundNext) withObject:nil];
    /*
    ADBannerView *adView = [[ADBannerView alloc] initWithFrame: CGRectMake(0, 318, 320, 50)];
    adView.requiredContentSizeIdentifiers = [NSSet setWithObjects: ADBannerContentSizeIdentifierPortrait, ADBannerContentSizeIdentifierLandscape, nil];
    adView.delegate = self; 
    //adView.delegate = ADBannerViewDelegate;
    [self.view addSubview: adView];
    */
}

- (void) loadImageInBackgroundNext
{
    if(count == max) {
        count=1;
    } else {
        count=count+1;
    }

    // Create a pool
    // NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    // Retrieve the remote image
    NSURL * imgURL = [NSURL URLWithString:[NSString stringWithFormat: @"http://www.site.com/image1.png"]];

    NSData *imgData = [NSData dataWithContentsOfURL:imgURL];
    UIImage *img    = [[UIImage alloc] initWithData:imgData];

    // Image retrieved, call main thread method to update image, passing it the downloaded UIImage
    [self performSelectorOnMainThread:@selector(assignImageToImageView:) withObject:img waitUntilDone:YES];

    // clean up
    // [pool release];
 }
...