开发者

UIAnimator message sent to deallocated instance

I am getting crazy:

*** -[UIAnimator removeAnimationsForTarget:]: message sent to deallocated instance 0x5ba13d0

It happens in different moments, when I scroll my开发者_如何转开发 tableview, when I switch my filter (a UISegmentedControl).

How can I fix it?


I just solved the same problem. I thought it was related to UIAnimation, but it was related to UITableViewCell, instead. I found a good starting point looking at this article.

http://marius.me.uk/blog/2011/mar/fixing-uianimator-removeanimationsfortarget-crash/

Good luck and let me know!


I had the same symptom (crash caused by [UIAnimator removeAnimationsForTarget:] message being sent to deallocated UITableViewCell, but it turned out to have been caused by a reason different from the one cited in the above solution. It turned out that the reason was that my UI was being updated by a non-UI thread. Specifically, I was calling popViewController:animated: from a background thread. When I moved this invocation to the UI thread via a callback the problem went away.


Both @er0 and @notme's answers are right.

When I made two different Cell UI in storyBoard and tried to use them in tableView:cellForRowAtIndexPath it gave me this error on a completely different button action. That method is not related to UITableViewCell in any way (AFAIK).

First I used @er0's way: on the method I was getting the crash, performed it in main thread.

performSelectorOnMainThread:withObject:waitUntilDone

It solved the crash.

Then I came to realize my tableView:cellForRowAtIndexPath code needs to be refactored. In some special situation I was using dequeueReusableCellWithIdentifier two times for a single indexPath. Refactored the code and placed the if-else in a way that dequeueReusableCellWithIdentifier is not called twice for a single indexPath. It solved my crash and I don't need the performSelectorOnMainThread" any more.

I ended up using notme's solution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜