{"action":"created","issue":{"url":"https://api.github.com/repos/smartdevicelink/sdl_ios/issues/341","repository_url":"https://api.github.com/repos/smartdevicelink/sdl_ios","labels_url":"https://api.github.com/repos/smartdevicelink/sdl_ios/issues/341/labels{/name}","comments_url":"https://api.github.com/repos/smartdevicelink/sdl_ios/issues/341/comments","events_url":"https://api.github.com/repos/smartdevicelink/sdl_ios/issues/341/events","html_url":"https://github.com/smartdevicelink/sdl_ios/issues/341","id":129611394,"number":341,"title":"Heartbeat timer still running after app disconnect.","user":{"login":"asm09fsu","id":830476,"avatar_url":"https://avatars.githubusercontent.com/u/830476?v=3","gravatar_id":"","url":"https://api.github.com/users/asm09fsu","html_url":"https://github.com/asm09fsu","followers_url":"https://api.github.com/users/asm09fsu/followers","following_url":"https://api.github.com/users/asm09fsu/following{/other_user}","gists_url":"https://api.github.com/users/asm09fsu/gists{/gist_id}","starred_url":"https://api.github.com/users/asm09fsu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asm09fsu/subscriptions","organizations_url":"https://api.github.com/users/asm09fsu/orgs","repos_url":"https://api.github.com/users/asm09fsu/repos","events_url":"https://api.github.com/users/asm09fsu/events{/privacy}","received_events_url":"https://api.github.com/users/asm09fsu/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/smartdevicelink/sdl_ios/labels/bug","name":"bug","color":"F44336"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/smartdevicelink/sdl_ios/milestones/6","html_url":"https://github.com/smartdevicelink/sdl_ios/milestones/4.0.X","labels_url":"https://api.github.com/repos/smartdevicelink/sdl_ios/milestones/6/labels","id":1125678,"number":6,"title":"4.0.X","description":"","creator":{"login":"joeljfischer","id":1767063,"avatar_url":"https://avatars.githubusercontent.com/u/1767063?v=3","gravatar_id":"","url":"https://api.github.com/users/joeljfischer","html_url":"https://github.com/joeljfischer","followers_url":"https://api.github.com/users/joeljfischer/followers","following_url":"https://api.github.com/users/joeljfischer/following{/other_user}","gists_url":"https://api.github.com/users/joeljfischer/gists{/gist_id}","starred_url":"https://api.github.com/users/joeljfischer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeljfischer/subscriptions","organizations_url":"https://api.github.com/users/joeljfischer/orgs","repos_url":"https://api.github.com/users/joeljfischer/repos","events_url":"https://api.github.com/users/joeljfischer/events{/privacy}","received_events_url":"https://api.github.com/users/joeljfischer/received_events","type":"User","site_admin":false},"open_issues":18,"closed_issues":35,"state":"open","created_at":"2015-05-22T13:25:41Z","updated_at":"2016-02-29T16:03:29Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2016-01-28T22:58:10Z","updated_at":"2016-03-03T15:00:53Z","closed_at":null,"body":"Currently, when connecting an app, the heartbeat timer functions and fires as intended. However, when the application is disconnected and the proxy is closed, the heartbeat timer still fires. It seems that although within `SDLTimer`, in the dealloc method, that `- (void)cancel` is in fact called, however it does not fire.  \r\n\r\nSolution:\r\n\r\nChange `SDLProtocol.m`:\r\n```\r\n- (void)destructObjects {\r\n    if (!_alreadyDestructed) {\r\n        _alreadyDestructed = YES;\r\n        self.messageRouter.delegate = nil;\r\n        self.messageRouter = nil;\r\n        self.transport = nil;\r\n        self.protocolDelegateTable = nil;\r\n        self.heartbeatTimer = nil;\r\n    }\r\n}\r\n```\r\n\r\nto \r\n```\r\n- (void)destructObjects {\r\n    if (!_alreadyDestructed) {\r\n        _alreadyDestructed = YES;\r\n        self.messageRouter.delegate = nil;\r\n        self.messageRouter = nil;\r\n        self.transport = nil;\r\n        self.protocolDelegateTable = nil;\r\n        [self.heartbeatTimer cancel];\r\n        self.heartbeatTimer = nil;\r\n    }\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/smartdevicelink/sdl_ios/issues/comments/191801843","html_url":"https://github.com/smartdevicelink/sdl_ios/issues/341#issuecomment-191801843","issue_url":"https://api.github.com/repos/smartdevicelink/sdl_ios/issues/341","id":191801843,"user":{"login":"kshala-ford","id":9195582,"avatar_url":"https://avatars.githubusercontent.com/u/9195582?v=3","gravatar_id":"","url":"https://api.github.com/users/kshala-ford","html_url":"https://github.com/kshala-ford","followers_url":"https://api.github.com/users/kshala-ford/followers","following_url":"https://api.github.com/users/kshala-ford/following{/other_user}","gists_url":"https://api.github.com/users/kshala-ford/gists{/gist_id}","starred_url":"https://api.github.com/users/kshala-ford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kshala-ford/subscriptions","organizations_url":"https://api.github.com/users/kshala-ford/orgs","repos_url":"https://api.github.com/users/kshala-ford/repos","events_url":"https://api.github.com/users/kshala-ford/events{/privacy}","received_events_url":"https://api.github.com/users/kshala-ford/received_events","type":"User","site_admin":false},"created_at":"2016-03-03T15:00:53Z","updated_at":"2016-03-03T15:00:53Z","body":"Copy pasted from some logs (not fully related to timer etc. but you can see the thread name):\r\nThread 5, name = (null) | [2016/03/03 11:39:30:480] -[SDLProtocol startHeartbeatTimerWithDuration:]\r\nThread 6, name = (null) | [2016/03/03 11:39:31:063] -[SDLTimer stopAndDestroyTimer]\r\nMain thread | [2016/03/03 11:40:00:522] -[SDLTimer stopAndDestroyTimer]"}}