swift/iOS:項目warning(警告)處理彙總(持續補充)

1、warning:Implicit conversion loses integer precision: 'NSInteger' (aka 'long') to 'int

解決方案:target->BuildSetting  -> Other Warning Flags 中添加

-Wno-shorten-64-to-32

 

2、cocopods去除三方庫的警告

解決方案:podfile中添加

inhibit_all_warnings!

 

3、warning: The image set name xxx is used by multiple image sets.

原因:Assets.xcasset中出現了兩張同名,或者在不同文件夾中重複添加了

解決方案:刪除同名文件即可

 

4、warning:'substring(from:)' is deprecated: Please use String slicing subscript with a 'partial...

原因:swift3廢除了substring(from:)、substring(to:)、substring(with:)三個方法

解決方案:

str.substring(from:index)替換爲:let newStr = String(str[..<index])

str.substring(to:index)替換爲:let newStr = String(str[index...])

str.substring(with:range)替換爲:let newStr = String(str[range])

5、warning:Implicit conversion loses integer precision: 'unsigned long' to 'CC_LONG' (aka 'unsigned int').

解決方案:

CC_MD5(str,strlen(str), r);,
改成了
CC_MD5(str,(CC_LONG)strlen(str), r);

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章