[绍棠] 消除Xcode iOS项目的警告
程序员文章站
2022-04-11 13:54:03
...
最近项目里的NSLog总是报 Expression result unused 警告, 于是收集了下消除警告的方法
第一种警告样式
ld: warning: directory not found for option '-F/Users/auto/Desktop/ECar_apps/ios/branches/EcarGroupon/EcarGroupon/Util/UMSocial_Sdk_Extra_Frameworks/TencentOpenAPI'
ld: warning: directory not found for option '-F/Users/auto/Desktop/ECar_apps/ios/branches/EcarGroupon/EcarGroupon/Util/umeng_ios_social_sdk_4.2.5_arm64_custom/UMSocial_Sdk_Extra_Frameworks/TencentOpenAPI'
ld: warning: directory not found for option '-F/Users/auto/Desktop/ECar_apps/ios/branches/EcarGroupon/EcarGroupon/Util/ThirdParty/umeng_ios_social_sdk_4.2.5_arm64_custom/UMSocial_Sdk_Extra_Frameworks/TencentOpenAPI'
第二种警告形式(xib)
This file is set to build for a version oldeer than the deployment target. functionality may be limited
第三种警告样式(storyboard)
第四种警告样式
ld: warning: no rule to process file XXX of type net.daringfireball.markdown for architecture x86_64
项目中经常见到的警告
第一种解决方式
错误如下,是查询 Library 的时候出现的异常找不到文件在这个位置;
ld: warning: directory not found for option '-L/' XXX
ld: warning: "directory not found for option '-F/..."
解决方法
1>依次 Project -> targets -> Build Setting -> Library Search Paths
删除里面的路径
2> 依次 Project -> targets -> Build Setting -> Framework Search Paths
删除里面的路径
简单说一下 Library Search Paths 和 Framework Search Paths
第二种解决方式
warning: Unsupported Configuration: This file is set to build for a version older than the deployment target. Functionality may be limited.
解决方法:
选中xib 的文件, 最后在 Builds for 选中 Project 见下图
第三种解决方式
问题 Automatic Preferred Max Layout Width before iOS 8.0
解决方法:
选中storyboard 的文件 , 看下图, 最后在 Builds for 选中 Project改为iOS 8.0 and later 见下图
编译警告
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
//这里写出现警告的代码就能实现去除警告
#pragma clang diagnostic pop
第四种解决方式
target >Build Phases > Compile Sources delete this file