![](/img/trans.png)
[英]How to completely hide the Xcode warning “Incompatible pointer to integer conversion sending 'id' to parameter of type (…)”?
[英]xcode: How to hide this warning?
我將ElementParser導入到我的項目中以解析html字符串。 但xcode在以下代碼中報告警告:
if ([connectionDelegate respondsToSelector:@selector(connection:didFailWithError:)])
[connectionDelegate connection:connection didFailWithError: error]; // Warning at this line
由於第一行有一個檢查,第二行必須在運行時是安全的。
我真的不喜歡在我的項目中存在警告。 所以我想知道是否還有隱藏這個警告?
首先將對象轉換為id
。
if ([connectionDelegate respondsToSelector:@selector(connection:didFailWithError:)])
[(id)connectionDelegate connection:connection didFailWithError: error];
或者,更好的是,正如@Rob建議的那樣,對於connectionDelegate類的@interface聲明,添加以下內容
@interface MyConnectDelegateClass : id<NSURLConnectionDelegate>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.