{"action":"opened","issue":{"url":"https://api.github.com/repos/lionheart/openradar-mirror/issues/3287","labels_url":"https://api.github.com/repos/lionheart/openradar-mirror/issues/3287/labels{/name}","comments_url":"https://api.github.com/repos/lionheart/openradar-mirror/issues/3287/comments","events_url":"https://api.github.com/repos/lionheart/openradar-mirror/issues/3287/events","html_url":"https://github.com/lionheart/openradar-mirror/issues/3287","id":100263419,"number":3287,"title":"18126382: Repeating animation bug","user":{"login":"openradar-mirror","id":13605213,"avatar_url":"https://avatars.githubusercontent.com/u/13605213?v=3","gravatar_id":"","url":"https://api.github.com/users/openradar-mirror","html_url":"https://github.com/openradar-mirror","followers_url":"https://api.github.com/users/openradar-mirror/followers","following_url":"https://api.github.com/users/openradar-mirror/following{/other_user}","gists_url":"https://api.github.com/users/openradar-mirror/gists{/gist_id}","starred_url":"https://api.github.com/users/openradar-mirror/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openradar-mirror/subscriptions","organizations_url":"https://api.github.com/users/openradar-mirror/orgs","repos_url":"https://api.github.com/users/openradar-mirror/repos","events_url":"https://api.github.com/users/openradar-mirror/events{/privacy}","received_events_url":"https://api.github.com/users/openradar-mirror/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/lionheart/openradar-mirror/labels/classification:other%20bug","name":"classification:other bug","color":"e11d21"},{"url":"https://api.github.com/repos/lionheart/openradar-mirror/labels/reproducible:always","name":"reproducible:always","color":"5319e7"},{"url":"https://api.github.com/repos/lionheart/openradar-mirror/labels/status:open","name":"status:open","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/lionheart/openradar-mirror/milestones/2","html_url":"https://github.com/lionheart/openradar-mirror/milestones/iOS","labels_url":"https://api.github.com/repos/lionheart/openradar-mirror/milestones/2/labels","id":1237416,"number":2,"title":"iOS","description":null,"creator":{"login":"openradar-mirror","id":13605213,"avatar_url":"https://avatars.githubusercontent.com/u/13605213?v=3","gravatar_id":"","url":"https://api.github.com/users/openradar-mirror","html_url":"https://github.com/openradar-mirror","followers_url":"https://api.github.com/users/openradar-mirror/followers","following_url":"https://api.github.com/users/openradar-mirror/following{/other_user}","gists_url":"https://api.github.com/users/openradar-mirror/gists{/gist_id}","starred_url":"https://api.github.com/users/openradar-mirror/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openradar-mirror/subscriptions","organizations_url":"https://api.github.com/users/openradar-mirror/orgs","repos_url":"https://api.github.com/users/openradar-mirror/repos","events_url":"https://api.github.com/users/openradar-mirror/events{/privacy}","received_events_url":"https://api.github.com/users/openradar-mirror/received_events","type":"User","site_admin":false},"open_issues":620,"closed_issues":0,"state":"open","created_at":"2015-08-03T02:08:30Z","updated_at":"2015-08-11T09:01:13Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2015-08-11T09:01:13Z","updated_at":"2015-08-11T09:01:13Z","closed_at":null,"body":"#### Description\n\nSummary:\r\nRemoving a CALayer with a endlessly repeating animation from layer tree and later adding it back ends up with odd state.\r\n\r\nAfter removing the layer, the animation calls animationDidStop:finished:. It is understandable because I believe the system stops the animation when its layer is detached from the layer tree.\r\n\r\nHowever, after adding the layer back to the layer tree, the animation is still going on. In one aspect, it is understandable because the animation is endlessly repeating. But, the animation does not call animationDidStart: again. So its delegate thinks it is still in stop state.\r\n\r\nWhat's even worse is that [layer animationForKey:animationKey] now returns nil even though the animation is still going on. So in effect, the animation is lost because I can not get the reference to it from the layer.\r\n\r\nThe most odd thing is that the animation can still be stopped by calling [layer removeAnimationForKey:animationKey] even though [layer animationForKey:animationKey] returns nil.\r\n\r\nAs you can see, quite a lot of things are inconsistent in this state.\r\n\r\nSteps to Reproduce:\r\n1. Launch sample app.\r\n2. Tap Remove button to remove the rotating view and read console log.\r\n3. Tap Add Back button to add the rotating view back and read console log.\r\n4. Tap Stop button to stop the rotating animation and read console log.\r\n\r\nExpected Results:\r\n1. CAAnimation delegate calls match the reality.\r\n2. CALayer should always return the animation from animationForKey: if the animation is still going on.\r\n\r\nActual Results:\r\n1. Animation is still going one after it calls animationDidStop:finished:.\r\n2. [CALayer animationForKey:] returns nil even though the animation is still going on.\r\n\r\nSample code:\r\nhttp://cl.ly/3w0q2c3U1h2X\n\n-\nProduct Version: 7 & 8\nCreated: 2014-08-25T23:22:00.845309\nOriginated: 2014-08-25T18:12:00\nOpen Radar Link: http://www.openradar.me/18126382"}}