I have this line in my main code:
[self performSelectorInBackground:@selector(animateMe) withObject:nil];
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
How do I solve that?
thanks.
- (void) animateMe {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[UIView animateWithDuration:1.0
animations:^{
[myView setAlpha:0.0f];
}];
[pool drain];
}
It's telling you exactly what's wrong - you don't have an autorelease pool in place when that selector gets executed. You need to add:
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
at the beginning, and:
[pool drain];
At the end of your method.
It may help someone
@autoreleasepool {
//enter code here
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With