1.報(bào)錯(cuò)顯示:
clang: error: cannot specify -o when generating multiple output files
clang: error: no input files
解決:
在工程文件targets-->build phases-->compile sources找到了幾個(gè)空白的文件,刪除掉了之后就沒有報(bào)錯(cuò)了,常見于多人開發(fā)
2.報(bào)錯(cuò)顯示:
view reuse identifier in nib (goods) does not match the identifier used to register the nib (like)
解決:
原因在于cell的注冊(cè)要在collectionView / tableView 添加進(jìn)view之前完成,在self.view執(zhí)行addSubview之前,注冊(cè)好指定的cell就行了
3.報(bào)錯(cuò)顯示
ld: 5 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation
解決:
重復(fù)導(dǎo)入了一些文件,在工程文件target -> build phases -> compile sources中找到提示中出現(xiàn)的文件,刪除重復(fù)導(dǎo)入的.m文件,如果繼續(xù)報(bào)錯(cuò),刪除原有的,重新導(dǎo)入,,常見于多人開發(fā)
4.報(bào)錯(cuò)顯示:
read failed: the data couldn't be read because it isn't in the correct format.
解決:
國(guó)際化語(yǔ)言包常見錯(cuò)誤诈唬,檢查string文件, 書寫key值的時(shí)候部分后面缺少分號(hào)
5.報(bào)錯(cuò)顯示:
ld: '/Users/***/Desktop/***/Pods/AlipaySDK/alipay/AlipaySDK.framework/AlipaySDK' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
解決:
TARGETS->Build Settings->Enable Bitcode漓库,設(shè)置成NO
6.報(bào)錯(cuò)顯示
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_UNUserNotificationCenter", referenced from:
objc-class-ref in libXG-SDK.a(XGPush.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
解決:
缺少某些類庫(kù)文件俯渤,referenced from前的即是提醒缺少的庫(kù),在targets中添加進(jìn)去即可
7.報(bào)錯(cuò)描述
Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: internal server error (500)"
服務(wù)器需要在header里面添加一些值熊杨,所以請(qǐng)求的時(shí)候添加數(shù)據(jù)孔轴,打印發(fā)現(xiàn)添加的header如下
"Accept-Language" = "zh-Hans-CN;q=1, en-CN;q=0.9, th-CN;q=0.8, ko-CN;q=0.7, zh-Hant-CN;q=0.6";
"User-Agent" = "TopTao/1.0.0 (iPod touch; iOS 9.3.5; Scale/2.00)";
"device_token" = **********;
"device_type" = ios;
token = ****************;
"user_id" = ****;
添加了deviece_token,device_type,token,user_id四個(gè)筋现,打印發(fā)現(xiàn)其中只有token這個(gè)key沒有雙引號(hào)矾睦,原因我也還沒找出來,服務(wù)器那邊接收數(shù)據(jù)發(fā)現(xiàn)只能識(shí)別到token规个,iOS這邊有問題凤薛,安卓沒事姓建,iOS用原生和第三方打印出來都是一樣的狀況
解決方法:
目前的解決方法是服務(wù)器做更改,服務(wù)器使用的框架對(duì)header的解析都是不一樣的缤苫,在公司里服務(wù)端用的是express速兔,改成restify可以識(shí)別出來,或者客戶端的header的key值使用駝峰命名法活玲,如device_type改成deviceType
8.報(bào)錯(cuò)描述:
Cannot synthesize weak property because the current deployment target does not support weak references
解決方法:
1涣狗、項(xiàng)目->TARGETS->IOS->Build Settings->Apple LLVM 7,1 - Language - Objective C->WeakReferences inManual Retain Release改為YES
2、如果不行舒憾,嘗試在podfile文件底下加入下面的代碼镀钓,'8.0'是對(duì)應(yīng)的部署目標(biāo)(deployment target)?
post_installdo|installer|
? ? ? ? installer.pods_project.targets.eachdo|target|
? ? ? ? ? ? ? ? ? target.build_configurations.eachdo|config|??
? ? ? ? ? ? ? ? ? ? ? ? ? ? config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] ='8.0'
? ? ? ? ? ? ? ? ? end
? ? ? ? ?end
end
原文鏈接:https://stackoverflow.com/questions/37160688/set-deployment-target-for-cocoapodss-pod
9.報(bào)錯(cuò)描述:
/Users/xiao/Library/Developer/Xcode/DerivedData/****-*****/Build/Products/Debug-iphoneos/*****.app: errSecInternalComponent
Command /usr/bin/codesign failed with exit code 1
解決方法:簽名機(jī)制問題,重啟電腦
10.報(bào)錯(cuò)描述:
cocoaPod 執(zhí)行 pod init 出現(xiàn)錯(cuò)誤:
――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
### Command
```
/usr/local/bin/pod init
```
### Report
* What did you do?
* What did you expect to happen?
* What happened instead?
### Stack
```
?? CocoaPods : 1.3.1
? ? ? ? Ruby : ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
? ? RubyGems : 2.6.14
? ? ? ? Host : Mac OS X 10.13.5 (17F77)
?? ? ? Xcode : 9.4.1 (9F2000)
?? ? ? ? Git : git version 2.15.2 (Apple Git-101.1)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ d7d26ef24b15e34a73767ce5712d03584de52516
```
### Plugins
```
cocoapods-deintegrate : 1.0.1
cocoapods-plugins? ? : 1.0.0
cocoapods-search? ? ? : 1.0.0
cocoapods-stats? ? ? : 1.0.0
cocoapods-trunk? ? ? : 1.3.0
cocoapods-try? ? ? ? : 1.1.0
```
### Error
```
RuntimeError - [Xcodeproj] Unknown object version.
/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.2/lib/xcodeproj/project.rb:217:in `initialize_from_file'
/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.2/lib/xcodeproj/project.rb:102:in `open'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/command/init.rb:41:in `validate!'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:333:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/bin/pod:55:in `'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `'
```
――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
解決方法:
打開項(xiàng)目镀迂,修改?xcodeproj 文件?Project Format ? 為Xcode 8.0-compatible掸宛,然后執(zhí)行pod init即可成功
11.報(bào)錯(cuò)描述:
UICollectionView執(zhí)行reloadData前,更新布局模式招拙,代碼如下:
strongSelf.contacCollectionView.collectionViewLayout =?strongSelf.flowLayout;
執(zhí)行此代碼時(shí)崩潰,崩潰信息為:
Thread 1: EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
該錯(cuò)誤提示一般時(shí)訪問了僵尸對(duì)象(對(duì)象已釋放)
解決方法:
調(diào)試時(shí)一直打印對(duì)象措译,發(fā)現(xiàn)都還有值别凤,還不懂是什么造成的,最后更改代碼后不會(huì)崩潰:
strongSelf.contacCollectionView.collectionViewLayout = (UICollectionViewFlowLayout*)strongSelf.contacCollectionView.collectionViewLayout;
12.報(bào)錯(cuò)描述:
reason: 'section footer height must not be negative - provided height for section 0 is -0.000001'
原因:
設(shè)置UITableView的estimatedSectionFooterHeight時(shí)领虹,設(shè)置為0.000001规哪,在iOS8,iOS9和iOS10時(shí)塌衰,應(yīng)不小于0
解決:
tableView.estimatedSectionFooterHeight = [UIDevice currentDevice].systemVersion.doubleValue < 11.0 ? 0 : 0.000001;
13.報(bào)錯(cuò)描述:
ld: warning: ignoring file /Users/... missing required architecture arm64 in file /Users/...
原因:
當(dāng)前使用的framework或者靜態(tài)庫(kù)不支持64位處理器
解決:
在Build Settings中的 Valid Architectures 中刪除arm64
14.錯(cuò)誤顯示:
橫屏下使用popoverPresentationController顯示出問題诉稍,自屏幕中間往下拉伸,豎屏?xí)r無問題
原因:
代理方法沒有實(shí)現(xiàn)完整
解決:
應(yīng)同時(shí)實(shí)現(xiàn)一下兩個(gè)方法:
- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller {
? ? return UIModalPresentationNone;
}
//此方法不實(shí)現(xiàn)橫屏下會(huì)出錯(cuò)
- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller traitCollection:(UITraitCollection *)traitCollection{
? ? return UIModalPresentationNone;
}