{"id":3961,"date":"2014-03-30T06:44:22","date_gmt":"2014-03-30T06:44:22","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/track-message-sent-to-deallocated-instance-via-instruments-collection-of-common-programming-errors\/"},"modified":"2014-03-30T06:44:22","modified_gmt":"2014-03-30T06:44:22","slug":"track-message-sent-to-deallocated-instance-via-instruments-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/track-message-sent-to-deallocated-instance-via-instruments-collection-of-common-programming-errors\/","title":{"rendered":"track &ldquo;message sent to deallocated instance&rdquo; via instruments-Collection of common programming errors"},"content":{"rendered":"<p>I had the same problem. At first I have used the Raffaello Colasante&#8217;s solution and passed <code>NO<\/code> to <code>scrollRectToVisible:animated:<\/code>. But then I&#8217;ve noticed that this method processed on another thread. You should check, whether you call <code>[uitableview scrollRectToVisible: CGRectMake(0,0,1,1) animated:YES]<\/code> on Main Thread (All ui actions should be performed on main thread). I change my code so to call it on Main Thread.<\/p>\n<p>From:<\/p>\n<pre><code>\/\/method called not from main thread\n...\n[someObjectInstance setOptionalActions:optActions];\n<\/code><\/pre>\n<p>To:<\/p>\n<pre><code>\/\/method called not from main thread\n...\ndispatch_async(dispatch_get_main_queue(), ^{\n    \/\/now method called from main thread\n    [someObjectInstance setOptionalActions:optActions];\n});\n<\/code><\/pre>\n<p>Note: (setOptionalActions:) call -&gt; (<b>scrollRectToVisible:animated:<\/b>)<\/p>\n<p>Now problem fixed.<\/p>\n<p>P.S. Instead of use Grand Central Dispatch(GCD), you can use another approach:<\/p>\n<pre><code>@implementation SomeObjectClass  \n...\n- (void) setOptionalActions:(NSArray *) actionsArray {\n    ... \/\/ handling of array\n    [myTableView scrollRectToVisible:CGRectMake(0,0,1,1) animated:YES];\n}\n...\n@end\n\n\/\/method called not from main thread, but will be performed on main thread\n[someObjectInstance performSelectorOnMainThread:@selector(setOptionalActions:) withObject:optionalActions waitUntilDone:NO];\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I had the same problem. At first I have used the Raffaello Colasante&#8217;s solution and passed NO to scrollRectToVisible:animated:. But then I&#8217;ve noticed that this method processed on another thread. You should check, whether you call [uitableview scrollRectToVisible: CGRectMake(0,0,1,1) animated:YES] on Main Thread (All ui actions should be performed on main thread). I change my [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3961","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3961"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3961\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}