原因是:因為你的證書在上一次安裝到現(xiàn)在安裝失敗這段時間里證書肯定被重置過薪丁,那么兩次的簽名就不一樣了掌唾,而你的Bundle identifier ID又是同一個,所以你這次安裝會失敗块蚌。
解決方法一(自已的總結(jié)):
把手機上相應(yīng)的APP刪除背传,刪除后,xcode clean下谷婆,然后重新運行路召,是不是成功了!解決方法二(網(wǎng)上的方法):
在stackoverflow上查找答案波材,有人說需要撤銷原來的inHouse證書股淡,然后重新制作新的證書和provisioning profile。
于是登錄Portal廷区,重新制作證書和Provisioning Profile唯灵。
將代碼重新簽名,再次打包隙轻。
程序正常啟動埠帕。
Command /Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
解決方法:Project Settings > Under "Targets", select your project > Build Phases > open "Compile Sources" and "Copy Bundle Resources". Check if any files are listed in red color. If so , just delete it. Then clean and run.
Xcode8導入框架出現(xiàn)"Use Legacy Swift Language Version"的報錯
具體解決辦法:
方法一:
1.點擊項目中的Pods垢揩。
2.選中你的框架,此處我導入的是ReactiveCocoa框架敛瓷。
3.選中Build Settings叁巨,然后在右邊搜索框輸入:swift
4.找到Swift Compiler - Search Paths 下的 Use Legacy Swift Language Version:把后面的改成YES即可。方法二:
勾選你想轉(zhuǎn)換的Swift的版本呐籽。然后點擊Next锋勺。
直接點擊update。特別強調(diào)的一點狡蝶,轉(zhuǎn)換過程中庶橱,會出現(xiàn)大量的報錯,不用擔心贪惹,轉(zhuǎn)換完畢直接build是會通過的
Your build settings specify a provisioning profile with the UUID‘XXX’, however, no such provisioning profile was found. Xcode can resolve this issue by downloading a new provisioning profile from the Member Center.
解決方法:關(guān)閉項目苏章,找到項目文件XXXX.xcodeproj,在文件上點擊右鍵奏瞬,選擇“顯示包內(nèi)容”(Show Package Contents)枫绅。會新打開一個Finder。
在新打開的Finder中找到project.pbxproj硼端,并且打開并淋,找到所有包含報錯的UUID‘XXX’的行(包含UUID后面的一串數(shù)字的行,可能不包含"UUID")显蝌,整行刪除预伺,保存订咸,重新啟動項目曼尊,再編譯,就OK了脏嚷。
CrashLog分析崩潰
- 使用Xcode查找crash log并解析:
(product -> archieve->找到.app和.dSYM,并與.crash放到同一個文件夾里)
找到.dSYM的位置 - 配置:Build Settings------>Debug information format ----選DWARF with dSYM File
- 路徑:“ 使用Finder前往路徑~/Library/Developer/Xcode/Archives/骆撇,可以看到日期目錄,目錄下有后綴名為xcarchive的文件父叙,選中該文件神郊,右鍵菜單選擇“顯示包內(nèi)容”,可以看到一個dsYMs目錄
- 將目錄中的XXX.app.dsYM文件拷出來趾唱,后面分析會用到涌乳。
- 如dSYM.app分析工具,可以百度搜索下載使用
在把項目打包成ipa包時甜癞,出現(xiàn)以下錯誤:
While reading /Users/apple/Downloads/kongyu/6_26Shopping2 2/6_26Shopping2/Default@2x.png pngcrush caught libpng error:臺\216\347\217?\232@A\347\217\320Command /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng emitted errors but did not return a nonzero exit code to indicate failure
解決辦法:
- project------>Build Settings ---->Compress PNG files 將其設(shè)置為NO
- 深度清理工程(shift + option + command + k)夕晓,清理完成后再編譯。
使用xib悠咱、autolayout 創(chuàng)建的界面蒸辆,崩潰征炼,報如下信息:
*** Assertion failure in -[NSLayoutConstraint constant], /SourceCache/Foundation/Foundation-1144.17/Layout.subproj/NSLayoutConstraint.m:643
或者:
Assertion failure in -[NSLayoutConstraint constant], /SourceCache/Foundation/Foundation /Layout.subproj/NSLayoutConstraint.m:6432015-10-26 08:43:06.080 AuberML[195:6172]
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '(null)'
原因:問題是IB將常數(shù)設(shè)置為“標準”,如果為標準的時候在iOS >= 9.0.1下躬贡,它的工作正常谆奥。iOS <9時則崩潰,它顯然與Main.storyboard約束的定義中的以下symbolic =“YES”語句有關(guān):
ndItem="c5b-4a-YMr" secondAttribute="bottom" multiplier="1175:1920" symbolic="YES" id="jgh-yf-mvT"/>```
![B8765392-7813-4FD1-ABDA-38CB4525E005.png](http://upload-images.jianshu.io/upload_images/2443108-4d169a659737242d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
解決辦法:將IB將常數(shù)設(shè)置為0
WebKit`WebKit::CompletionHandlerCallChecker::~CompletionHandlerCallChecker()
如下詳細信息:
2017-06-14 22:15:30.331795+0800 Living[3104:1156485] invalid mode 'kCFRunLoopCommonModes' provided to CFRunLoopRunSpecific - break on _CFRunLoopError_RunCalledWithInvalidMode to debug. This message will only appear once per execution.
libc++abi.dylib: terminate_handler unexpectedly threw an exception
(lldb) bt
* thread #1: tid = 0x11a585, 0x0000000187ff1014 libsystem_kernel.dylib`__pthread_kill + 8, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x0000000187ff1014 libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x00000001880bb334 libsystem_pthread.dylib`pthread_kill + 112
frame #2: 0x0000000187f659c4 libsystem_c.dylib`abort + 140
frame #3: 0x0000000187a311b0 libc++abi.dylib`abort_message + 132
frame #4: 0x0000000187a475f0 libc++abi.dylib`std::__terminate(void (*)()) + 44
frame #5: 0x0000000187a46ef8 libc++abi.dylib`__cxa_throw + 136
frame #6: 0x0000000187a5866c libobjc.A.dylib`objc_exception_throw + 364
frame #7: 0x0000000188ff6f20 CoreFoundation`+[NSException raise:format:] + 116
frame #8: 0x0000000192685660 WebKit`WebKit::CompletionHandlerCallChecker::~CompletionHandlerCallChecker() + 144
frame #9: 0x00000001926c53d8 WebKit`WTF::ThreadSafeRefCounted<WebKit::CompletionHandlerCallChecker>::deref() const + 40
frame #10: 0x00000001926c4c14 WebKit`__destroy_helper_block_.138 + 68
frame #11: 0x0000000187f03a68 libsystem_blocks.dylib`_Block_release + 160
frame #12: 0x0000000187a76134 libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 836
frame #13: 0x0000000188ed2b18 CoreFoundation`_CFAutoreleasePoolPop + 28
frame #14: 0x00000001899f3dc8 Foundation`-[NSAutoreleasePool drain] + 148
frame #15: 0x000000018cecb2d4 JavaScriptCore`WTF::AutodrainedPool::~AutodrainedPool() + 32
frame #16: 0x000000018d86d098 JavaScriptCore`WTF::RunLoop::performWork(void*) + 44
frame #17: 0x0000000188fa5424 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
frame #18: 0x0000000188fa4d94 CoreFoundation`__CFRunLoopDoSources0 + 540
frame #19: 0x0000000188fa29a0 CoreFoundation`__CFRunLoopRun + 744
frame #20: 0x0000000188ed2d94 CoreFoundation`CFRunLoopRunSpecific + 424
frame #21: 0x000000018a93c074 GraphicsServices`GSEventRunModal + 100
frame #22: 0x000000018f18b130 UIKit`UIApplicationMain + 208
* frame #23: 0x000000010049489c CNLiving`main(argc=1, argv=0x000000016fd23958) + 124 at main.m:14
frame #24: 0x0000000187ee159c libdyld.dylib`start + 4
(lldb)
原因拂玻、解決辦法酸些,實現(xiàn)如下方法并調(diào)用decisionHandler(...):
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
{
// NSLog(@"%@--%@",hostname,navigationAction.request.URL);
// decisionHandler(WKNavigationActionPolicyCancel);
decisionHandler(WKNavigationActionPolicyAllow);
}
AFNetworking 請求設(shè)置說明:
_mannager = [AFHTTPRequestOperationManager manager];
//傳入json格式數(shù)據(jù),不寫則普通post
_mannager.requestSerializer = [AFJSONRequestSerializer serializer];
//默認返回JSON類型(可以不寫)
_mannager.responseSerializer = [AFHTTPResponseSerializer serializer];
//設(shè)置返回類型
_mannager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
library not found for -lPods
一般來說這個錯就是庫的連接引用有問題纺讲,常見解決辦法:
方法一:在Build Phases 中的 Link Binary With Libraries 中對其xxx取消并且重新引用(灰色引用庫都表示失效了擂仍,需要刪除引用)。
如果還未解決熬甚,那可能是其它的原因逢渔,參考鏈接
Variable 'buttonTag' may be uninitialized when used here
Variable 'buttonTag' may be uninitialized when used here
是因為你的buttonTag
為枚舉類型,初始化申明的時候未賦初始值乡括,設(shè)置個初始值就可以了肃廓。
cocoapod安裝錯誤:[!] Invalid Podfile
file: syntax error, unexpected end-of-input, expecting keyword_end.
podfile文件末尾未添加 end;
解決:在Podfile的末尾添加 end诲泌,如果你有多個target盲赊,需要在第一個target 的庫引用完畢后添加end,如下圖:
cocoapod常見錯誤這個挺全面的:http://www.reibang.com/p/dfc7b93e67eb
合并framework庫報錯:can't move temporary file:
neghaodeiMac:~ neghao$ lipo -create /Users/neghao/Desktop/22/IJKMediaFramework.framework/IJKMediaFramework /Users/neghao/Desktop/IJKMediaFramework.framework/IJKMediaFramework -output /Users/neghao/Desktop/ijk
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't move temporary file: /Users/neghao/Desktop/ijk to file: /Users/neghao/Desktop/ijk.lipo (Is a directory)
是因為輸出的文件沒有取名敷扫,給輸出的文件也取個名字就可以:
......前面不變 -output /Users/neghao/Desktop/ijk/IJKMediaFramework.framework
“The file ”MyApp.app“ couldn't be opened because you don't have permission to view it”
工程中有兩個或者多個plist文件哀蘑,把重復的刪除,然后深度清理工程(command + option + shift + k)葵第,再運行绘迁。
Xocde9.1上打開xib文件崩潰:
Xcode crashes due to 'There can only be one document registered with a given URL.
Application Specific Information:
ProductBuildVersion: 8E3004b
ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-12175.1/IDEKit/Application/IDEDocumentController.m:2136
Details: There can only be one document registered with a given URL. newDocument:<IDEWorkspaceDocument: 0x7ff6612d6cd0>( 0 -[IDEWorkspaceDocument init] (in IDEKit)
1 -[NSDocument initForURL:withContentsOfURL:ofType:error:] (in AppKit)
2 -[IDEWorkspaceDocument initForURL:withContentsOfURL:ofType:error:] (in IDEKit)
3 -[NSDocumentController makeDocumentForURL:withContentsOfURL:ofType:error:] (in AppKit)
4 __104-[NSDocumentController makeDocumentForURL:withContentsOfURL:alternateContents:ofType:completionHandler:]_block_invoke (in AppKit)
5 -[NSDocumentController makeDocumentForURL:withContentsOfURL:alternateContents:ofType:completionHandler:] (in AppKit)
6 __89-[NSDocumentController reopenDocumentForURL:withContentsOfURL:display:completionHandler:]_block_invoke (in AppKit)
解決辦法:Remove this folder
/Users/<your user name>/Library/Saved\ Application\ State/com.apple.dt.Xcode.savedState
引用鏈接
Xcode運行項目時報:"You don’t have permission."
原因:你添加庫或者其實文件時帶有plist文件一起拖進去了,導致你工程有多個plist文件
解決辦法:刪除那個多余的文件卒密。
真機運行時(基本都是發(fā)生在第一次)蹦出彈窗:
App installation failed
Could not inspect the application package.
幾種處理方法:
1. product name為中文缀台,就會出現(xiàn)這個問題。嘗試各種clean哮奇,刪資源膛腐,解決不了。把product name改成英文就好了鼎俘。
2. 某個Resources文件名可能跟內(nèi)部有沖突哲身,重新修改資源名稱;
3. 然后再清理:發(fā)生這個問題后贸伐,一定要用Clean Build Folder...勘天,單純的Clean無法解決問題。