你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> cannot find protocol declaration for RefreshAudioListViewDelegate

cannot find protocol declaration for RefreshAudioListViewDelegate

編輯:IOS開發綜合
[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.2cto.com    @interface 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;   @interface 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; ">@interface 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>  
  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved