开发工程中遇到的BUG
Xcode7自帶Git創(chuàng)建的項目"Couldn’t communicate with a helper application"
- git ?
- xcode7
- 關(guān)注?3?關(guān)注
- 收藏?0?收藏,4.9k?瀏覽
Xcode7在創(chuàng)建項目的時候勾選此選項,
創(chuàng)建出來的項目會報如下錯誤警告:
"Couldn't communicate with a helper application",
我重啟Xcode然后編譯代碼,通過Xcode自帶commit提交,
還是會出現(xiàn)下面的錯誤警告
"Couldn't communicate with a helper application",
我就去了,helper application是什么啊?????
實在搞不懂了????
是我打開的方式不對嗎?
1、Couldn’t communicate with a helper application in Xcode 7
問題一:
Couldn't communicate with a helper application in Xcode 7
翻譯:不能與助手應(yīng)用程序通信在Xcode7中(helper ->指的是git)
解決:
終端輸入:
Xcrun git config --global user.email 郵箱
xcrun git config --global user.name gitHub的你的名字
2、網(wǎng)上下載的Demo運(yùn)行時報錯
問題二:
網(wǎng)上下載的Demo運(yùn)行時報錯
ld:library not find for -lpods-xxxxxx
clang: error: linker command failed with exit code 1 (use -v to see invocation)
解決:
1. 首先查看本地是否安裝cocoapods, 如果沒安裝請先安裝pod,
2. 如果安裝cocoapods,請打開終端,cd ~/到你工程文件夾(或者將文件夾直接拖到終端中)
3. 使用命令行 pop install --verbose --no-repo-update
4. 請使用xxx.xcworkspace打開工程
3、Xcode升級導(dǎo)致插件失效
問題三:
Xcode升級導(dǎo)致插件失效
解決:
1. 在終端輸入defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID查看xcode的UUID。
2. 找到xcode插件所在的目錄:~/Library/Application Support/Developer/Shared/Xcode/Plug-ins。在plist文件中找到DVTPlugInCompatibilityUUIDs, 點擊加號, 添加一個item, 對應(yīng)的value值為輸入剛才終端中獲得的UUID,cmd + s保存。
3. 重啟Xcode,彈出的對話框中選擇Load Bundle
4. 如果誤點Skip Bundle,找到該插件安裝路徑下,繼續(xù)打開在 info.plist 刪除與命令端里面同樣的UUID號,一般都是會在最后一行,自己添加的那一行也要刪除掉。保存之后重啟Xcode,再次重復(fù)上面的步奏。在重啟就再次出現(xiàn)了插件提示
4、Unable to add app id because the '10' APP ID limit in '7'days has been exceeded
問題四:
Unable to add app id because the '10' APP ID limit in '7'days has been exceeded
翻譯:無法添加應(yīng)用程序id,因為“10”應(yīng)用程序id已經(jīng)超過限制(7日)
解決:
此問題針對于真機(jī)測試:
在developer center 重新設(shè)置一遍自己的APP ID 然后將APP ID 作為 Bundle ID添加到工程
免證書進(jìn)行xcode真機(jī)調(diào)試方法:http://www.jianshu.com/p/3b2be6454462
5、Undefined symbols for architecture armv7:ld: symbol(s) not found for architecture armv7
問題五:
5.1: Undefined symbols for architecture armv7:
"_compress2", referenced from:
+[UMANDeflated deflatedDataPrefixedWith:level:source:] in libMobClickLibrary.a(UMDeflated.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
解決:
檢查項目友盟這個庫的依賴呀.確認(rèn)庫已經(jīng)導(dǎo)入而且在鏈接的二進(jìn)制庫里面.(就是build phases里面).
檢查是否某些文件路徑未加入進(jìn)來或者寫錯了
把xx文件庫+進(jìn)來
5.2: *** 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
解決:友盟的二進(jìn)制庫不支持bitcode.而Xcode默認(rèn)是要支持bitcode的,而且如果支持的話,其中所有的二進(jìn)制庫和framework都必須包含bitcode(工程build setting -> build options ->Enable Bitcode設(shè)置為關(guān)閉)
6、installation failed invalid argument
問題6
?installation failed invalid argument
翻譯:安裝失敗,參數(shù)非法
原因:我把Bundle indentifier 置為空了!
解決1:
1、Quit Xcode
2、Clean out ~/Library/Developer/Xcode/DerivedData manually
3、rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
4、iOS Simulator > Reset Content and Settings
解決2:隨便添加一個Bundle indentifier
7、看不見控件是什么原因
原因:
1、根本沒有創(chuàng)建實例化這個控件
2、沒有設(shè)置尺寸
3、控件的顏色跟父控件的背景色一樣
4、透明度alpha<=0.01
5、hidden = YES
6、沒有添加到父控件中
7、被其他控件擋住了
8、位置不對
9、父控件發(fā)生了以上變化
10、特殊情況
*UIIamgeView沒有設(shè)置image屬性,或者設(shè)置的圖片名不對
*UILabel沒有設(shè)置文字,或者文字顏色和父控件的背景色一樣
*UITextField沒有設(shè)置文字,或者沒有設(shè)置邊框樣式borderStyle
*UIPageControl沒有設(shè)置總頁數(shù),不會顯示小圓點
*UIButton內(nèi)部imageView和titleLabel的frame被篡改了,或者沒有內(nèi)容
建議:
1、最好設(shè)置背景色和尺寸
2、控件的顏色盡量不要跟父控件的背景色一樣
8、在Archive項目時,出現(xiàn)了“Your build settings specify a provisioning profile with the UUID “”, however, no such provisioning profile was found”的出錯。一直提示指定UUID的provisioning profile找不到
問題8
在Archive項目時,出現(xiàn)了“Your build settings specify a provisioning profile with the UUID “”, however, no such provisioning profile was found”的出錯。一直提示指定UUID的provisioning profile找不到
解決:
1.找到項目中的**.xcodeproj文件,點擊右鍵,show package contents(打開包內(nèi)容)。
2.打開后找到project.pbxproj文件,用文本編輯器打開。其實就是右鍵,點擊open就好了。
3.打開這個文件后,按command+F,在這個文件中查找“PROVISIONING_PROFILE",找到和這個“
PROVISIONING_PROFILE = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";”類似的都刪除。
4.然后保存文件,重新打開項目。xcode會提示你重新下載安裝provisioning profile文件。下載后安裝上就可以。
9、真機(jī)運(yùn)行時,提示The executable was signed with invalid entitlements.
1.在工程中添加文件new file,選擇plist文件,添加后名稱為Entitlements.plist。
2.點擊Entitlements.plist進(jìn)行編輯,刪除所有Root下的Key,然后添加一個Boolean類型,名稱為get-task-allow的Key,Value為YES。
3.在Targets中的Build Setting選項卡中的Code Signing Entitlements的值設(shè)為Entitlements.plist,重新Build即可解決。
10、the file couldn't be opened because you don't have permission to view it
解決方法一:changed the value of the "Compiler for C/C++/Objective-C" to Default Compiler.
解決方法二:Project---Build Setting中 修改這一項,變成Default Compiler(Apple LLVM 6.0)
解決方法三:command + shift + k
解決方法四:xcode頁面command +','調(diào)出設(shè)置頁面點擊最后一個'Location選項',點擊第一個小箭頭 會跳轉(zhuǎn)到一個文件夾-->>刪除文件夾-->>command+shift+K Claen一下-->> command + R
11、error: [__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]
@interface ...
@property (nonatomic, readonly, strong) NSMutableArray *videos;
@end
@implementation ...
//懶加載初始化
- (id)init {
self = [super init];
if (self) {
_videos = [NSMutableArray new];
}
return self;
}
12、UIWebView 加載https站點出現(xiàn)NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9843)
http://www.itnose.net/detail/6042798.html
13、在使用百度地圖時,使用的時候下面一句報錯了~BMKMapPoint *pionts = new BMKMapPoint[index];用下面這句也報錯? ? delete []points;
解決方案:將把文件后綴從m改成了mm。
分析:變態(tài)的百度靜態(tài)庫中采用ObjectC++實現(xiàn),以上兩句時ObjectC++的特性。如果把文件后綴改為mm,則xcode會用ObjectC++的方式來編譯文件。
14、setValue:forUndefinedKey: this class is not key value coding-compliant for the key
要設(shè)置tableviewCell的customClass,而不是file‘s owner的custom class
15、_BSMachError: (os/kern) invalid capability (20) \
_BSMachError: (os/kern) invalid name (15) \
原因:是自己在alertAction中添加了時間,但是并未采用延時機(jī)制。
[alertVC addAction:[UIAlertAction actionWithTitle:@"現(xiàn)在升級" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
//這里添加了多線程,消除警告
dispatch_after(0.2, dispatch_get_main_queue(), ^{
NSURL *appStoreUrl = [NSURL URLWithString:[NSString stringWithFormat:kAppStore_APPVersionUrl,APP_ID]];
[[UIApplication sharedApplication] openURL:appStoreUrl];
NSLog(@"鏈接--%@",appStoreUrl);
});
}]];
16、command/usr/bin/codesign failed with exit code 1- code sign error
http://stackoverflow.com/questions/29242485/command-usr-bin-codesign-failed-with-exit-code-1-code-sign-error
17、ld: 4 duplicate symbols for architecture x86_64
問題? ld: 4 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
解決: "duplicate"和"symbols"。duplicate的中文意思是“重復(fù)的、復(fù)制的”,而symbols的意思是“符號”。也就是可能在你工程中引入了重復(fù)的東西。
第一種情況:在工程中重復(fù)導(dǎo)入了某一個類或文件,這一般出現(xiàn)在你添加第三方庫的時候比較多,在不知道的情況下又導(dǎo)入了一次相同的類。
第二種情況:工程中在#import引入頭文件的時候,將#import "XXX.h" 寫成了#import "XXX.m"。錯誤的引入.m頭文件
18、layoutSubviews什么時候調(diào)用
layoutSubviews在以下情況下會被調(diào)用:
1、init初始化不會觸發(fā)layoutSubviews
2、addSubview會觸發(fā)layoutSubviews
3、設(shè)置view的Frame會觸發(fā)layoutSubviews,當(dāng)然前提是frame的值設(shè)置前后發(fā)生了變化
4、滾動一個UIScrollView會觸發(fā)layoutSubviews
5、旋轉(zhuǎn)Screen會觸發(fā)父UIView上的layoutSubviews事件
6、改變一個UIView大小的時候也會觸發(fā)父UIView上的layoutSubviews事件
19、-[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[2]
字典不能傳空值
20、-[__NSDictionaryM objectAtIndexedSubscript:]: unrecognized selector sent
__NSDictionaryM? 無法將值傳到下標(biāo)索引對象,就是數(shù)組越界,并且不是數(shù)組,而是字典,所以,遇到這種crash
兩種情況:
1.首先看看你 indexPath.row 用的有沒有問題;
2.看看你請求下來的數(shù)據(jù)類型對不對。
21、Error Domain=kCLErrorDomain Code=2 “The operation couldn’t be completed. (kCLErrorDomain error 2.)”
網(wǎng)絡(luò)錯誤,CLGeocoder需要一個網(wǎng)絡(luò)連接,不應(yīng)該每分鐘發(fā)送多個地理編碼請求.geocoder斷絕希望保護(hù)自己免受被請求從一個設(shè)備過載。你只是必須限制你發(fā)送的請求數(shù)
22、NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: NSBundle
方法一:
1. Right Click - Delete and Remove Reference
2. 重新引入文件
方法二:重命名該文件
23、objc_msgSend()報錯Too many arguments to function call ,expected 0,have3
Build Setting--> Apple LLVM ?- Preprocessing--> Enable Strict Checking of objc_msgSend Calls? 改為 NO
24、void SendDelegateMessage(NSInvocation *): delegate (webView:decidePolicyForNewWindowAction:request:
- (void)dealloc {
_webview.delegate = nil;
[_webview stopLoading];
}
25、too many errors emitted, stopping now解決辦法 / 莫名其妙的錯誤:could not build module ‘Foundation’
讓整個pch文件的內(nèi)容在這兩行代碼以內(nèi)
#ifdef __OBJC__
#endif
26、Host is down -sendto(2) '192.168.1.2' port 53
看看自己的網(wǎng)絡(luò)吧騷年,DNS和路由器IP不對應(yīng)。
27、[NSISObjectiveLinearExpression coefficientForVariable:]: unrecognized selector sent to instance 0x1cd93850
- (void) viewWillDisappear: (BOOL) animated {
[super viewWillDisappear: animated];
// Force any text fields that might be being edited to end so the text is stored
[self.view.window endEditing: YES];
}
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
持續(xù)更新中。。。
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
作者:JJ駿
鏈接:https://www.jianshu.com/p/39bb64d8397f
來源:簡書
著作權(quán)歸作者所有。商業(yè)轉(zhuǎn)載請聯(lián)系作者獲得授權(quán),非商業(yè)轉(zhuǎn)載請注明出處。
轉(zhuǎn)載于:https://www.cnblogs.com/sundaysgarden/p/9094775.html
總結(jié)
以上是生活随笔為你收集整理的开发工程中遇到的BUG的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 004 IOC---IOC容器
- 下一篇: where/、trim/ 标签的使用