iphone-在没有池的情况下自动释放-只是泄漏 [英] iphone - autoreleased with no pool in place - just leaking

查看:54
本文介绍了iphone-在没有池的情况下自动释放-只是泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的主要代码中有这一行:

I have this line in my main code:

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

这是animateMe

and this is the animateMe

- (void) animateMe {

  [UIView animateWithDuration:1.0
     animations:^{
           [myView setAlpha:0.0f];

  }];

}

这些是我在终端上看到的消息

these are the messages I see on terminal

 *** __NSAutoreleaseNoPool(): Object 0x1af740 of class myClass autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x1af740 of class myClass autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x1af740 of class myClass autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x193190 of class CABasicAnimation autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x1b8230 of class NSConcreteValue autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x1af740 of class myClass autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x1c0ee0 of class CABasicAnimation autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x1b4260 of class NSCFNumber autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x1aeb30 of class __NSCFDictionary autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x1debd0 of class myClass autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x1debd0 of class myClass autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x1debd0 of class myClass autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x1dad90 of class CABasicAnimation autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x16db40 of class NSConcreteValue autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x1debd0 of class myClass autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x1aafc0 of class CABasicAnimation autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x1dfc10 of class NSCFNumber autoreleased with no pool in place - just leaking
 *** __NSAutoreleaseNoPool(): Object 0x1d1470 of class __NSCFDictionary autoreleased with no pool in place - just leaking

我该如何解决?

谢谢.

推荐答案

- (void) animateMe {
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  [UIView animateWithDuration:1.0
     animations:^{
           [myView setAlpha:0.0f];

  }];
  [pool drain];
}

这篇关于iphone-在没有池的情况下自动释放-只是泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆