Type '' cannot conform to protocol '' because it has requirements that cannot be satisfied
我有一個Objective-C協議,我試圖在Swift類中實現。例如:
@class AnObjcClass;
@protocol ObjcProtocol <NSObject>
- (void)somethingWithAnArgument:(AnObjcClass *)arg;
@end
當我嘗試在這樣的Swift類中符合它時:
@objc class SwiftClass: NSObject, ObjcProtocol {
// ...
}
我得到以下可怕的編譯器錯誤:
Type ‘‘ cannot conform to protocol ‘‘ because it has requirements that cannot be satisfied
我該如何解決這個問題?
解決方案:
確保該協議引用的任何類都包含在橋接頭中。
當協議中使用的某個類型(協議本身,返回類型,參數類型)未包含在Swift橋接頭中時,會發生此錯誤。
由於@class AnObjcClass
前向聲明,Objective-C類可以愉快地實現此協議,但似乎Swift類不能實現使用僅向前聲明的類的協議。
Type '' cannot conform to protocol '' because it has requirements that cannot be satisfied
相關推薦
Type 39;39; cannot conform to protocol 39;39; because it has requirements that cannot be satisfied
jcp eth clas onf block some 編譯器 conf @class 我有一個Objective-C協議,我試圖在Swift類中實現。例如: @class AnObjcClass; @protocol ObjcProtocol <NSObjec
ueditor百度富文字編輯器linux下報錯: class path resource [config.json] cannot be resolved to absolute file path because it does not reside in the file system
具體報錯資訊如下 java.io.FileNotFoundException: class path resource [config.json] cannot be resolved to absolute file path because it does not reside in the fi
cannot be resolved to absolute file path because it does not reside in the file system
使用maven分模組元件專案的時候,domain中的實體的*.hbm.xml檔案不能被spring掃描到,因為聚合的時候核心包已經達成jar包了,所以要去jar中去找hbm.xml檔案 <!--注入sessionFactory --> <bea
【GP的空間】EveryBody in the world should learn how to program a computer...because it teaches you how to think. \n --Steve Jobs
GP的空間 EveryBody in the world should learn how to program a computer...because it teaches you how to think....
Vue的報錯:Uncaught TypeError: Cannot assign to read only property 39;exports39; of object 39;#<Object>39;
pac rop space efault type require bject default logs 剛剛運行一下以前的一個Vue+webpack的demo,運行之後沒有出現想象中的效果,並且報錯 Uncaught TypeError: Cannot assign t
Cannot assign to read only property 39;exports39; of object 39;#<Object>39;
tro 小項目 uncaught ann sig 分享 方式 技術 image 運行一下以前的一個Vue+webpack的 vue仿新聞網站 小項目,報錯 由於自己vue學習不深入,老是這個報錯,找了好久(確切的說是整整一下午^...^)才找到原因 -v- Uncaugh
Invalid 39;log4jConfigLocation39; parameter: class path resource [log4j.xml] cannot be resolved to URL because it does not exist
cau 是否 大堆 class not tomcat cati gpo div 有一天手賤,無意間把eclipse中項目刪了,重新從svn上拉代碼,然後在導進eclipse,啟動Tomcat,報錯 Invalid ‘log4jConfigLocation‘ paramete
git同步遇到報錯“fatal: unable to access 39;https://github.com/ruanwenwu/newp.git/39;: Peer reports incompatible or unsupported protocol version.”
版本升級 pat gpo new 依然 curl ted git pos git同步遇到報錯“fatal: unable to access ‘https://github.com/ruanwenwu/newp.git/‘: Peer reports incompatibl
git同步遇到報錯“fatal: unable to access 39;https://github.com/lizhong24/mysite2.git/39;: Peer reports incompatible or unsupported protocol version.”
tps 問題解決 問題 ces proto fat version prot nco git同步遇到報錯“fatal: unable to access ‘https://github.com/lizhong24/mysite2.git/‘: Peer reports in
cannot call methods on dialog prior to initialization; attempted to call method 39;close39;
使用jquery dialog 彈出框,點選確定後,執行dwr 刪除方法 ,報這個錯誤 cannot call methods on dialog prior to initialization; attempted to call method 'close'
JDBC報錯java.sql.SQLException: Cannot convert value 39;0000-00-00 00:00:0039; from column 14 to T
出現這個錯誤的原因是:當資料庫中的Date型別欄位值是 ‘0000-00-00’時,JDBC不能把’0000-00-00’轉化為一個java.sql.Date 問題的解決方案是在連線資料庫的url後加入?zeroDateTimeBehavior=convertToNull 如:
python報TypeError: cannot convert the series to <class 39;float39;>
場景:在使用python進行資料格式轉換時,想將利用正則表示式取出的一列值轉換為float格式,轉換前檢查該列的格式是object 1:原格式檢視 in: data1['coupon_money'].dtype out:
error C2664: 39;strtol39; : cannot convert parameter 1 from 39;CString39; to 39;const char *39;
text=strtol(m_recieve,NULL,16); 其中text為long型,m_recieve為CString型。 編譯錯誤: error C2664: ‘strtol’ : cannot convert parameter 1 from ‘CString’ to ‘const
java.sql.SQLException: Cannot convert value 39;0000-00-00 00:00:0039; from column 7 to TIMESTAMP
在Mysql資料庫中使用DATETIME型別來儲存時間,使用JDBC中讀取這個欄位的時候,應該使用 ResultSet.getTimestamp(),這樣會得到一個java.sql.Timestamp型別的資料。在這裡既不能使用 ResultSet.getDate(),也不能使用ResultSet.
@cannot lock ref 39;HEAD39;: unable to resolve reference 39;refs/heads/master39;: reference broken解決方法
@cannot lock ref ‘HEAD’: unable to resolve reference ‘refs/heads/master’: reference broken解決 修改了一小點東西打算commit,成功以後然後打算push,這時候悲劇發生了,我的垃圾電腦自動重啟了,
Mybatis中對於Mysql資料庫中NULL的日期資料報錯 mysql錯誤: Cannot convert value 39;0000-00-00 00:00:0039; from column 10 to TIMESTAMP
原 mysql錯誤: Cannot convert value '0000-00-00 00:00:00' from column 10 to TIMESTAMP 2010年06月01日 17:38:00 閱讀數:5307
vue執行報錯error:Cannot assign to read only property 39;exports39; of object 39;#<Object>39;
用weex做專案的時候,npm start 之後一直報錯error:Cannot assign to read only property 'exports' of object '#<Object>' ,查了好多資料好像是export和import共用了導致不相容引起的 試了好多方法都不行,最
Angular 7 使用require 出現的問題: Cannot find name 39;require39;. Do you need to install......
報錯詳情: 建立了一個新的angular專案,打算通過require使用js,出現了“ERROR in src/app/app.component.ts(11,9): error TS2580: Cannot find name 'require'. Do you need to install
git提交代碼出現錯誤fatal: Unable to create 39;項目路徑/.git/index.lock39;: File exists.
log stack sts exists 下一個 flow code .cn create git提交代碼出現錯誤fatal: Unable to create ‘項目路徑/.git/index.lock‘: File exists. 具體出錯代碼如下: 具體原因不詳
wamp不能使用phpmyadmin,提示“You don39;t have permission to access /phpmyadmin/ on this server.”
you 提示 yml override cnblogs option rri dmi multiview 當你安裝完成wamp後,打開localhost或ip時發現已經可以運行了 但想使用phpmyadmin時,發現提示如下內容: You don‘t have permi