EXC_BAD_ACCESS at searchbar when there are 2 Words?

99封情书 提交于 2019-12-25 01:52:58

问题


The problem is when I write a Letter like "Pasar" the error not showing, but when I press space the error like exc_bad_access showing, why can it be? any one can't tell me about exc_bad_access..

I'am using xcode 4.2 and build at iPhone 5.0 Simulator.


回答1:


Try using NSZombies. In your project info, set NSZombieEnabled to YES. Read this to enable NSZombie in your project.

Its just a memory management problem. You'll be releasing something earlier and then using it or you'll be using some variable which doesnt have memory allocated to it. NSZombie will tell you where the app got crashed.




回答2:


[self setSearchResults:[self.array filteredArrayUsingPredicate:resultPredicate]];

Your search result is deallocating instead of using "=" assign value to setSearchResults use this.



来源:https://stackoverflow.com/questions/7105670/exc-bad-access-at-searchbar-when-there-are-2-words

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!