開發工程中遇到的BUG

0

Xcode7在建立項目的時候勾選此選項,
Snip20151008_2.png
建立出來的項目會報以下錯誤警告:
"Couldn't communicate with a helper application",
Snip20151008_4.png
html

我重啓Xcode而後編譯代碼,經過Xcode自帶commit提交,
Snip20151008_5.pnggit

仍是會出現下面的錯誤警告
Snip20151008_6.png
"Couldn't communicate with a helper application",
我就去了,helper application是什麼啊?????
實在搞不懂了????
是我打開的方式不對嗎?
web

一、Couldn’t communicate with a helper application in Xcode 7

問題一:segmentfault

Couldn't communicate with a helper application in Xcode 7數組

翻譯:不能與助手應用程序通訊在Xcode7中(helper ->指的是git)xcode

解決:網絡

終端輸入:多線程

Xcrun git config --global user.email 郵箱app

xcrun git config --global user.name gitHub的你的名字iphone


二、網上下載的Demo運行時報錯

問題二:

網上下載的Demo運行時報錯

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打開工程


三、Xcode升級致使插件失效

問題三:

Xcode升級致使插件失效

解決:

1. 在終端輸入defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID查看xcode的UUID。

2. 找到xcode插件所在的目錄:~/Library/Application Support/Developer/Shared/Xcode/Plug-ins。在plist文件中找到DVTPlugInCompatibilityUUIDs, 點擊加號, 添加一個item, 對應的value值爲輸入剛纔終端中得到的UUID,cmd + s保存。

3. 重啓Xcode,彈出的對話框中選擇Load Bundle

4. 若是誤點Skip Bundle,找到該插件安裝路徑下,繼續打開在 info.plist 刪除與命令端裏面一樣的UUID號,通常都是會在最後一行,本身添加的那一行也要刪除掉。保存以後重啓Xcode,再次重複上面的步奏。在重啓就再次出現了插件提示


四、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

翻譯:沒法添加應用程序id,由於「10」應用程序id已經超過限制(7日)

解決:

此問題針對於真機測試:

在developer center 從新設置一遍本身的APP ID 而後將APP ID 做爲 Bundle ID添加到工程

免證書進行xcode真機調試方法:http://www.jianshu.com/p/3b2be6454462


五、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)

解決:

檢查項目友盟這個庫的依賴呀.確認庫已經導入並且在連接的二進制庫裏面.(就是build phases裏面).

檢查是否某些文件路徑未加入進來或者寫錯了

把xx文件庫+進來

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

解決:友盟的二進制庫不支持bitcode.而Xcode默認是要支持bitcode的,並且若是支持的話,其中全部的二進制庫和framework都必須包含bitcode(工程build setting -> build options ->Enable Bitcode設置爲關閉)


六、installation failed invalid argument

問題6

 installation failed invalid argument

翻譯:安裝失敗,參數非法

緣由:我把Bundle indentifier 置爲空了!

解決1:

一、Quit Xcode

二、Clean out ~/Library/Developer/Xcode/DerivedData manually

三、rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"

四、iOS Simulator > Reset Content and Settings

解決2:隨便添加一個Bundle indentifier


七、看不見控件是什麼緣由

緣由:

一、根本沒有建立實例化這個控件

二、沒有設置尺寸

三、控件的顏色跟父控件的背景色同樣

四、透明度alpha<=0.01

五、hidden = YES

六、沒有添加到父控件中

七、被其餘控件擋住了

八、位置不對

九、父控件發生了以上變化

十、特殊狀況

*UIIamgeView沒有設置image屬性,或者設置的圖片名不對

*UILabel沒有設置文字,或者文字顏色和父控件的背景色同樣

*UITextField沒有設置文字,或者沒有設置邊框樣式borderStyle

*UIPageControl沒有設置總頁數,不會顯示小圓點

*UIButton內部imageView和titleLabel的frame被篡改了,或者沒有內容

建議:

一、最好設置背景色和尺寸

二、控件的顏色儘可能不要跟父控件的背景色同樣


八、在Archive項目時,出現了「Your build settings specify a provisioning profile with the UUID 「」, however, no such provisioning profile was found」的出錯。一直提示指定UUID的provisioning profile找不到

問題8

在Archive項目時,出現了「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(打開包內容)。

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文件。下載後安裝上就能夠。


九、真機運行時,提示The executable was signed with invalid entitlements.

1.在工程中添加文件new file,選擇plist文件,添加後名稱爲Entitlements.plist。

2.點擊Entitlements.plist進行編輯,刪除全部Root下的Key,而後添加一個Boolean類型,名稱爲get-task-allow的Key,Value爲YES。

3.在Targets中的Build Setting選項卡中的Code Signing Entitlements的值設爲Entitlements.plist,從新Build便可解決。


十、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 +','調出設置頁面點擊最後一個'Location選項',點擊第一個小箭頭 會跳轉到一個文件夾-->>刪除文件夾-->>command+shift+K Claen一下-->> command + R


十一、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;

}


十二、UIWebView 加載https站點出現NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9843)

http://www.itnose.net/detail/6042798.html


1三、在使用百度地圖時,使用的時候下面一句報錯了~BMKMapPoint *pionts = new BMKMapPoint[index];用下面這句也報錯    delete []points;

解決方案:將把文件後綴從m改爲了mm。

分析:變態的百度靜態庫中採用ObjectC++實現,以上兩句時ObjectC++的特性。若是把文件後綴改成mm,則xcode會用ObjectC++的方式來編譯文件。


1四、setValue:forUndefinedKey: this class is not key value coding-compliant for the key

要設置tableviewCell的customClass,而不是file‘s owner的custom class


1五、_BSMachError: (os/kern) invalid capability (20) \

_BSMachError: (os/kern) invalid name (15) \

緣由:是本身在alertAction中添加了時間,可是並未採用延時機制。

[alertVC addAction:[UIAlertAction actionWithTitle:@"如今升級" 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);

});

}]];


1六、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


1七、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的中文意思是「重複的、複製的」,而symbols的意思是「符號」。也就是可能在你工程中引入了重複的東西。

第一種狀況:在工程中重複導入了某一個類或文件,這通常出如今你添加第三方庫的時候比較多,在不知道的狀況下又導入了一次相同的類。

第二種狀況:工程中在#import引入頭文件的時候,將#import "XXX.h" 寫成了#import "XXX.m"。錯誤的引入.m頭文件


1八、layoutSubviews何時調用

layoutSubviews在如下狀況下會被調用:

一、init初始化不會觸發layoutSubviews

二、addSubview會觸發layoutSubviews

三、設置view的Frame會觸發layoutSubviews,固然前提是frame的值設置先後發生了變化

四、滾動一個UIScrollView會觸發layoutSubviews

五、旋轉Screen會觸發父UIView上的layoutSubviews事件

六、改變一個UIView大小的時候也會觸發父UIView上的layoutSubviews事件


1九、-[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[2]

字典不能傳空值


20、-[__NSDictionaryM objectAtIndexedSubscript:]: unrecognized selector sent

__NSDictionaryM  沒法將值傳到下標索引對象,就是數組越界,而且不是數組,而是字典,因此,遇到這種crash

兩種狀況:

1.首先看看你 indexPath.row 用的有沒有問題;

2.看看你請求下來的數據類型對不對。

2一、Error Domain=kCLErrorDomain Code=2 「The operation couldn’t be completed. (kCLErrorDomain error 2.)」

網絡錯誤,CLGeocoder須要一個網絡鏈接,不該該每分鐘發送多個地理編碼請求.geocoder斷絕但願保護本身免受被請求從一個設備過載。你只是必須限制你發送的請求數

2二、NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: NSBundle

方法一:

1. Right Click - Delete and Remove Reference

2. 從新引入文件

方法二:重命名該文件

2三、objc_msgSend()報錯Too many arguments to function call ,expected 0,have3

Build Setting--> Apple LLVM  - Preprocessing--> Enable Strict Checking of objc_msgSend Calls  改成 NO

2四、void SendDelegateMessage(NSInvocation *): delegate (webView:decidePolicyForNewWindowAction:request:

- (void)dealloc {

_webview.delegate = nil;

[_webview stopLoading];

}

2五、too many errors emitted, stopping now解決辦法 / 莫名其妙的錯誤:could not build module ‘Foundation’

讓整個pch文件的內容在這兩行代碼之內

#ifdef __OBJC__

#endif

2六、Host is down -sendto(2) '192.168.1.2' port 53

看看本身的網絡吧騷年,DNS和路由器IP不對應。

2七、[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];

}

。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

持續更新中。。。

。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

做者:JJ駿 連接:https://www.jianshu.com/p/39bb64d8397f 來源:簡書 著做權歸做者全部。商業轉載請聯繫做者得到受權,非商業轉載請註明出處。
相關文章
相關標籤/搜索