The development process will encounter a lot of small problems, the solution is just a word or a small knowledge point, can not gather up a blog post, therefore, the "tips for the development of the iOS" series blog, only to record the development of "Flash", the title of the blog post with the digital marker (1) (2) (3) .... , each article 30, will continue to update ....
1. Problem: Declare a protocol in a class (CustomView):
@protocol customviewdelegate-(void) showactionsheet; @end
A proxy is also defined:
@property (Nonatomic,strong) id<customviewdelegate> delegate;
However, the use of proxies is an error:
if ([Dele respondstoselector: @selector (showactionsheet)]) {...}
Error:
No known instance method for selector ' Respondstoselector: '
Reason: Declared protocol customviewdelegate not inherited <NSObject>
2, Question: exec_bad_access
The general reason is to send a message to an already Dealloc object, which can be debugged using nszombieenabled for this reason. The steps are as follows:
(1)
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/70/C2/wKiom1W8vLmS_k2OAAGAnHA1JKo227.jpg "style=" width : 300px;height:88px; "title=" QQ20150801-1@2x.png "width=" height= "0" border= "0" hspace= "0" vspace= " Wkiom1w8vlms_k2oaaganha1jko227.jpg "/>
(2)
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/70/BF/wKioL1W8wHjg1Y_UAAGZxVG6xnU261.jpg "title=" QQ20150801-2@2x.png "width=" "height=" 279 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:500PX;HEIGHT:279PX; "alt= "Wkiol1w8whjg1y_uaagzxvg6xnu261.jpg"/>
In this way, any object that is released will become an _ Nszombie, and when a message is sent to _nszombie, the corresponding error message is printed without crash or strange behavior.
This article is from the "Layne Learning Corner" blog, please be sure to keep this source http://laynestone.blog.51cto.com/9459455/1680868
Tips for developing iOS (1)