当前位置:编程学习 > wap >>

cannot find protocol declaration for "RefreshAudioListViewDelegate"

[html]  
今天一个很易做图的问题卡住了:cannot find protocol declaration for "RefreshAudioListViewDelegate"<p></p><p><span style="color: rgb(186, 45, 162); font-family: Menlo; font-size: 11px; ">1.在PlayerController.h</span>自定义了 一个代理 <span style="font-family: Menlo; font-size: 11px; ">RefreshAudioListViewDelegate</span></p><p style="margin-top: 0px; margin-bottom: 0px; font-size: 11px; font-family: Menlo; color: rgb(209, 46, 27); ">  
</p><pre name="code" class="html">#import "<span style="font-family: Menlo; font-size: 11px; ">PlayerListViewController.h</span>"  
@protocol RefreshAudioListViewDelegate <NSObject>  
- (void) updateCurrentPlayedAudio:(NSUInteger) currentPlayedIndex;  
@end  www.zzzyk.com
  
@inte易做图ce PlayerController : NSObject</pre>  
<p></p>  
<p style="margin-top:0px; margin-bottom:0px; font-size:11px; font-family:Menlo; color:rgb(209,46,27)">  
<br>  
</p>  
<p style="margin-top:0px; margin-bottom:0px; font-size:11px; font-family:Menlo; color:rgb(209,46,27)">  
<br>  
</p>  
<br>  
2.在<span style="font-family:Menlo; font-size:11px">PlayerListViewController.h中</span>  
<pre></pre>  
<pre name="code" class="html">#import "PlayerController.h"  
  
@class PlayerController;  
@inte易做图ce PlayerListViewController : UIViewController< RefreshAudioListViewDelegate>  
{  
    PlayerController                 *playerController;  
}</pre><br>  
<br>  
<p style="margin-top:0px; margin-bottom:0px; font-size:11px; font-family:Menlo; color:rgb(209,46,27)">  
编译器提示“cannot find protocol declaration for "RefreshAudioListViewDelegate”</p>  
<p style="margin-top:0px; margin-bottom:0px; font-size:11px; font-family:Menlo; color:rgb(209,46,27)">  
分析原因:</p>  
<p style="margin-top:0px; margin-bottom:0px; font-size:11px; color:rgb(209,46,27)">  
<span style="font-family:Menlo">在编译器编译顺序:</span></p><pre name="code" class="html" style="font-family: Menlo; "><span style="font-family: Menlo; font-size: 11px; ">1.PlayerListViewController.h文件时,首先发现#import "PlayerController.h",编译器会跑到PlayerController.h中。</span></pre><pre name="code" class="html" style="font-family: Menlo; "><span style="font-family: Menlo; font-size: 11px; ">2.在PlayerController.h中首先发现#import "PlayerListViewController.h",编译器又会到PlayerListViewController中加载内容。</span></pre><pre name="code" class="html"><span style="font-size: 11px; "><span style="font-family:Menlo;">3.这时 当见到</span></span><pre name="code" class="html" style="font-family: Menlo; ">@inte易做图ce PlayerListViewController : UIViewController< RefreshAudioListViewDelegate>这一句的时候,由于在PlayerController中定义代理的语句还没有加载,所以编译器会报错:</pre><pre name="code" class="html"><pre name="code" class="html" style="font-family: Menlo; ">cannot find protocol declaration for "RefreshAudioListViewDelegate"</pre><pre name="code" class="html" style="font-family: Menlo; "></pre><pre name="code" class="html"><span style="font-family:Menlo;">解决办法:</span></pre><pre name="code" class="html"><span style="font-family:Menlo;">删除PlayerController.h中的</span><pre name="code" class="html">#import "<span style="font-family: Menlo; font-size: 11px; ">PlayerListViewController.h</span>"</pre><p></p>  
<pre></pre>  
<pre></pre>  
<pre></pre>  
<p></p>  
  
</pre></pre></pre>  
补充:移动开发 , IOS ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,