前言:
? ? ? ? 好記性不如爛筆頭,雖然不喜歡寫(xiě)文章,但是為了時(shí)間久了不會(huì)忘掉,也該嘗試的把開(kāi)發(fā)中遇到的問(wèn)題用筆記的形式記錄下來(lái)了。
一、
? ? ? ? ?*報(bào)錯(cuò):CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 9.3'*
? ? ? ? *解決方法:將Build Settings里面的code signing 改為iOS developer *
二、
? ? ? ? ?*報(bào)錯(cuò):[BEROR]CodeSign error: Certificate identity ‘iPhone Distribution: *.’ appears more than once in the keychain. The codesign tool requires there only be one.**
? ? ? ? ?*解決方案:上述錯(cuò)誤是在項(xiàng)目進(jìn)行Archive打包時(shí)出現(xiàn)的。
? ? ? ? ?原因:出現(xiàn)此問(wèn)題的原因是多個(gè)證書(shū)之間沖突造成。
? ? ? ? ?解決方案:打開(kāi)mac系統(tǒng)的“實(shí)用工具”-“鑰匙串訪問(wèn)”-“我的證書(shū)”中,如果看到有重復(fù)的證書(shū)名,那么請(qǐng)將早期的證書(shū)刪除掉,重啟Xcode。*
三、
? ? ? ? ?*報(bào)錯(cuò):Could not change executable permissions on the application.*
? ? ? ? ?*解決方案原因:擁有相同的bundle Identifier已經(jīng)在設(shè)備上運(yùn)行。解決辦法:刪除設(shè)備中或者模擬器中的App。*
四、
? ? ? ? ? *報(bào)錯(cuò):ld: library not found for -lmp3lameclang: error: linker command failed with exit code 1 (use -v to see invocation).*
? ? ? ? ? *解決方案:原因:在工作中,一般是多人編輯同一個(gè)工程時(shí)其中一人沒(méi)將某個(gè)庫(kù)上傳導(dǎo)致的。解決方案:上傳具體靜態(tài)庫(kù)*
五、
? ? ? ? ? ? *報(bào)錯(cuò):A valid provisioning profile matching the application's Identifier 'XXXX' could not be found*
? ? ? ? ? ? *解決方案:原因:當(dāng)編譯后出現(xiàn)上述問(wèn)題,缺少證書(shū)或者是在Code Signing Identity處沒(méi)有選擇對(duì)應(yīng)的證書(shū)或者是證書(shū)不對(duì)應(yīng)。
? ? ? ? ? ? ?解決辦法:重裝證書(shū),檢查證書(shū)是否是否選擇是否對(duì)應(yīng)。*
六、
? ? ? ? ? ? *報(bào)錯(cuò):在ARC項(xiàng)目中,使用了MRC模式開(kāi)發(fā)的第三方庫(kù)*
? ? ? ? ? ? *解決方案:1)打開(kāi)項(xiàng)目所屬的TARGETS設(shè)置2)點(diǎn)擊Build Phases選項(xiàng),進(jìn)入到子項(xiàng)Compile Sources中,找到使用MRC的文件,添加-fno-objc-arc標(biāo)記,表明在編譯時(shí),該文件使用MRC編譯3)相反的,如果想在MRC項(xiàng)目中,使用ARC的文件,可以使用 -fobjc-arc 標(biāo)記即可*
七、
? ? ? ? ? ? ? *報(bào)錯(cuò):Xcode編譯出現(xiàn)Link錯(cuò)誤,出現(xiàn)“duplicate symbols for architecture i386 clang”提示*
? ? ? ? ? ? ? *解決方案:?jiǎn)栴}:鏈接時(shí),項(xiàng)目有重名文件解決方案:1.在Xcode的Targets->Bulid Phases-Link Binary With Libraries中查看有無(wú)重復(fù)的lib2.全工程搜索下重名文件*
八、
? ? ? ? ? ? ? *報(bào)錯(cuò):關(guān)于category位于靜態(tài)庫(kù),引用該靜態(tài)庫(kù)的工程使用其中的Category,出現(xiàn)“unrecognized sent to class”提示。*
? ? ? ? ? ? ?*解決方案:?jiǎn)栴}:標(biāo)準(zhǔn)靜態(tài)庫(kù)與OC之間的linker的差異。在標(biāo)準(zhǔn)的UNIX靜態(tài)庫(kù),linker symbol是依照每一個(gè)類(lèi)別而產(chǎn)生的,但由于category并沒(méi)有產(chǎn)生一個(gè)類(lèi)別,所以拋出上述錯(cuò)誤。
? ? ? ? ? ? ? ?解決辦法:1.在該靜態(tài)庫(kù)的Targets->Bulid Setting->Linker flags->在其中添加-Objc2.在使用該靜態(tài)庫(kù)的工程Targets->Build Setting->Linker Flags->加上-all_load或者-force_load*
九、
? ? ? ? ? ? ? *報(bào)錯(cuò):warning:ld:warning directory not found for option'-L'*
? ? ? ? ? ? ?*解決方案:?jiǎn)栴}:通常是path問(wèn)題TargetsText 里面找到Build Setting ,然后Library Search Paths和Framework Search Paths,刪除掉編譯報(bào)warning的路徑即可。*
十、
? ? ? ? ? ? ? Xcode運(yùn)行時(shí)打印臺(tái)報(bào)以下警告 ?CUICatalog: Invalid asset name supplied:
? ? ? ? ? ? ? 解決方案:由于給imageNamed:@"" 添加圖片的時(shí)候傳了空字符串或者在文件中找不到對(duì)應(yīng)的圖片,檢查下所有添加image的地方,包括xib和sb里面
十一、
? ? ? ? ? ? ? ?有一天發(fā)現(xiàn)Xcode 7.3上面看不到iOS8.*的視圖層次圖了,在Debug area,看見(jiàn)下面的錯(cuò)誤日子;
? ? ? ? ? ? -[UIWindow viewForFirstBaselineLayout]: unrecognized selector sent to instance 0x7fa018c428a0
解決方案:添加一個(gè)UIView的拓展 ? ? //Xcode 7.3上面看不到iOS8.*的視圖層次圖
```
+ (void)load {
if ([self instancesRespondToSelector:@selector(viewForFirstBaselineLayout)]) {
return ;
}
Method original = class_getInstanceMethod(self, ? ?@selector(viewForBaselineLayout));
class_addMethod(self, @selector(viewForFirstBaselineLayout), method_getImplementation(original), method_getTypeEncoding(original));
class_addMethod(self, @selector(viewForLastBaselineLayout), method_getImplementation(original), method_getTypeEncoding(original));
}
```
十二、
Xcode打印臺(tái)打印出 ?CUICatalog: Invalid asset name supplied:
說(shuō)明是有圖片設(shè)置的為nil
找到對(duì)應(yīng)的地方設(shè)置圖片就可以了
###14、
AFN報(bào)錯(cuò)
Assertion failure in -[AFHTTPRequestSerializer requestWithMethod:URLString:parameters:error:], /Users/Yan/Desktop/Yan/Doctor/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.m:353
2016-04-24 11:22:01.022 fastDoctor[4725:172619] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: URLString'
```
原因reason: 'Invalid parameter not satisfying: URLString'
URL拼接錯(cuò)誤!!! ?----