Question

i m en utilisant cette méthode sur didselectrow de UITableViewCell

[NSThread detachNewThreadSelector:@selector(showMyWaitView) toTarget:self withObject:nil];

il fonctionne très bien, mais il montre erreur dans gdb comme ceci

2009-08-10 12: 45: 01,313 FlashCards [1209: 6307] * _NSAutoreleaseNoPool (): Object 0x458200 de UIView de classe autoreleased sans piscine en place - juste une fuite Stack: (0x907d7adf 0x906e41f2 0x29a6 0x906eabad 0x906ea754 0x93e2d6f5 0x93e2d5b2) 2009-08-10 12: 45: 01,314 FlashCards [1209: 6307] * _NSAutoreleaseNoPool (): Object 0x2a0e8 de classe NSCFString autoreleased sans piscine en place - juste une fuite Stack: (0x907d7adf 0x906e41f2 0x30ad10b0 0x30ad12e6 0x29c5 0x906eabad 0x906ea754 0x93e2d6f5 0x93e2d5b2)

J'ai aussi essayé la minuterie, mais cela ne fonctionne pas

mon code Timer est cette

MyTimer = [NSTimer timerWithTimeInterval: 0,01 cible: sélecteur auto: @selector (showMyWaitView) userInfo: néant répétitions: NO];     [[NSRunLoop mainRunLoop] addTimer: MyTimer forMode: NSDefaultRunLoopMode];

J'ai aussi essayé

MyTimer = [NSTimer scheduledTimerWithTimeInterval:0.0001 target:self selector:@selector(showMyWaitView) userInfo:nil repeats:NO]; 

[NSThread sleepForTimeInterval: 0,03];

et ceci est ma méthode showMyWaitView

-(void)showMyWaitView
{
[self.view addSubview:MyWaitViewObj.view];
}

voici ma méthode a fait selectrow

  if(MyWaitViewObj==nil)
{
    MyWaitViewObj = [[MyWaitViewController alloc] initWithNibName:@"MyWaitView" bundle:nil];
}

//MyTimer = [NSTimer scheduledTimerWithTimeInterval:0.0001 target:self selector:@selector(showMyWaitView) userInfo:nil repeats:NO]; 
MyTimer = [NSTimer timerWithTimeInterval:0.01 target:self selector:@selector(showMyWaitView) userInfo:nil repeats:NO];
[[NSRunLoop mainRunLoop] addTimer:MyTimer forMode: NSDefaultRunLoopMode];
[NSThread detachNewThreadSelector:@selector(showMyWaitView) toTarget:self withObject:nil];
//[NSThread sleepForTimeInterval:0.03];

[indexTableView deselectRowAtIndexPath:indexPath animated:YES];
categoryId = [[listOfCategoryId objectAtIndex:indexPath.section] intValue];
categoryType=[[listOfCategoryType objectAtIndex:indexPath.section] intValue];
[self getFlashCard:categoryId];
flashcardid = [[flashCardsId objectAtIndex:indexPath.row] intValue];
//NSLog(@"%s %d %s", __FILE__, __LINE__, __PRETTY_FUNCTION__, __FUNCTION__);
    if(MyPageViewControllerObj==nil)
    {
        MyPageViewController *vController= [[MyPageViewController alloc] initWithNibName:@"MyPageView" bundle:[NSBundle mainBundle]];
        self.MyPageViewControllerObj=vController;
        [vController release];
    }
  //

    MyPageViewControllerObj.sessionid=sessionid;
    MyPageViewControllerObj.categoryID = categoryId;
    MyPageViewControllerObj.flashcardIdforcount = flashcardid;
    MyPageViewControllerObj.categoryType=categoryType;
    MyPageViewControllerObj.indexViewControllerobj=self;
    [self.navigationController pushViewController:MyPageViewControllerObj animated:YES];
    [MyPageViewControllerObj refreshMyPageView];
    //[MyPageViewControllerObj release];
    NSLog(@"My MySlidingController View Ka retain Count=%d",[MyPageViewControllerObj retainCount]);
[MyWaitViewObj.view removeFromSuperview];

Comment afficher l'indicateur d'activité en utilisant la minuterie s'il vous plaît me aider ou me dire cette erreur sera gdb plantage de l'application de la cause

Était-ce utile?

La solution

Si vous configurez un fil, vous devez configurer la boucle d'exécution et de créer un NSAutoreleasePool pour ce thread aussi bien, qui est libéré lors de la sortie de fil. Le problème est que vous faites lorsque vous ne tirez votre sélection comme ça. Votre showMyWait devrait mettre en place la piscine de libération, documentation NSThread

  

Pour les non-déchets collectés   applications, le procédé est aSelector   créer un responsable de l'établissement   autorelease pour piscine nouvellement   fil individuel et de libérer ce pool   avant sa sortie. Ordures collectées   les applications ne ont pas besoin de créer un   autorelease piscine.

Autres conseils

Toutes les mises à jour de l'interface utilisateur doit être fait sur le thread principal.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top