開發(fā)中的問題集合

1.Terminating app due to uncaught exception 'NSUnknownKeyException', reason

網(wǎng)上搜了一大堆恰聘,都是說XIB的關(guān)聯(lián)問題,我把xib文件刪除了連接,重新連了一下商膊,還是報(bào)錯(cuò)类嗤。后來發(fā)現(xiàn)是我的代碼問題裂七。

NSMutableDictionary *dict = (NSMutableDictionary *)array.lastObject;
[dict setValue:textString forKey:@"limit"];

array.lastObject不是可變字典褥符,這里我把它強(qiáng)轉(zhuǎn)了,導(dǎo)致
[dict setValue:textString forKey:@"limit"];報(bào)錯(cuò)韭寸。
用 NSDictionary 就可以了春哨。

2. 重新安裝xcode cocoapods出現(xiàn)

          Unable to download data from https://gems.ruby-china.org/ - bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)```, 即執(zhí)行``` sudo gem install cocoapods 

出現(xiàn)的錯(cuò)
執(zhí)行 sudo -i, 進(jìn)入到 root 去執(zhí)行 該命令

sudo -i 

在去執(zhí)行

sudo gem install cocoapods

結(jié)果為

Successfully installed cocoapods-1.6.1
Parsing documentation for cocoapods-1.6.1
Done installing documentation for cocoapods after 2 seconds
1 gem installed

退出root, 重新打開一個(gè)窗口恩伺,執(zhí)行 pod --version赴背,查看版本,但是現(xiàn)在又報(bào)錯(cuò)了

Ignoring executable-hooks-1.4.2 because its extensions are not built.  Try: gem pristine executable-hooks --version 1.4.2
Ignoring gem-wrappers-1.3.2 because its extensions are not built.  Try: gem pristine gem-wrappers --version 1.3.2
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:241:in `bin_path': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)
    from /usr/local/bin/pod:22:in `<main>'

接著刪除了gem ,清除所有包舊版本晶渠,保留最新版

gem cleanup

結(jié)果為

Cleaning up installed gems...
Clean Up Complete

查看gem版本

gem update

結(jié)果為

2.6.14

接著執(zhí)行

gem update

又報(bào)錯(cuò)了

Updating installed gems
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)

解決辦法:
先后執(zhí)行下面2行代碼:

sudo gem sources -r https://rubygems.org
結(jié)果為:
Password:
source https://rubygems.org not present in cache
sudo gem sources -a http://rubygems.org
結(jié)果為:
https://rubygems.org is recommended for security over http://rubygems.org

Do you want to add this insecure source? [yn]  y
http://rubygems.org added to sources

就可以正常安裝了
執(zhí)行

sudo gem install cocoapods

結(jié)果為:

………………(代表還有很多命令)
Parsing documentation for molinillo-0.6.6
Installing ri documentation for molinillo-0.6.6
Parsing documentation for atomos-0.1.3
Installing ri documentation for atomos-0.1.3
Parsing documentation for nanaimo-0.2.6
Installing ri documentation for nanaimo-0.2.6
Parsing documentation for xcodeproj-1.8.1
Installing ri documentation for xcodeproj-1.8.1
Parsing documentation for fourflusher-2.2.0
Installing ri documentation for fourflusher-2.2.0
Parsing documentation for ruby-macho-1.4.0
Installing ri documentation for ruby-macho-1.4.0
Parsing documentation for cocoapods-1.6.1
Installing ri documentation for cocoapods-1.6.1
Done installing documentation for cocoapods-core, cocoapods-downloader, cocoapods-trunk, molinillo, atomos, nanaimo, xcodeproj, fourflusher, ruby-macho, cocoapods after 9 seconds
WARNING:  Unable to pull data from 'https://gems.ruby-china.org/': bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)
10 gems installed

3. 更新cocoaPods凰荚,執(zhí)行命令 sudo gem update --system .出現(xiàn)了錯(cuò)誤: ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError); bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)

原來是cocoapods更新了褒脯,本來是1.6.0便瑟,執(zhí)行了下面命令更新pod之后,版本變?yōu)?.7.0.beta.3

sudo gem install -n /usr/local/bin cocoapods --pre

再去執(zhí)行一些命令就好了

4. ld: framework not found Pods__________ clang: error: linker command failed with exit code 1 (use -v to see invocation)

出現(xiàn)這個(gè)問題番川,把Build Settings ---->的 Other Linker Flags里面的所有庫都刪除了胳徽,就只剩下了第二個(gè)圖里面的

2291553674047_.pic_hd.jpg

2301553675241_.pic_hd.jpg

然后把Build PhasesLinker Binary With Libraries刪除不存在(顯示為顏色灰白)的庫
在command +shift +k, 清空一下,重新運(yùn)行爽彤,即可了

5. ld: library not found for -lstdc++.6.0.9 , clang: error: linker command failed with exit code 1 (use -v to see invocation)

多數(shù)情況下是文件路徑配置問題
Building Phases下面的 Link Binary With Libraries把這個(gè)庫show In Finder, 發(fā)現(xiàn)并不是在工程里路徑下,重新把它拖到了工程目錄里面缚陷,就好了适篙。

2331553839647_.pic.jpg

2341553840027_.pic.jpg

6. Could not insert new outlet connection, could not find any information for the class named DemoViewController

把DemoViewController.h 和 DemoViewController.m 先show In finder, 拷貝出來,在工程里面刪除箫爷,重新添加就好了

7. cell復(fù)用問題導(dǎo)致頁面上展示的數(shù)組順序錯(cuò)亂

在實(shí)例化cell的時(shí)候, 把cell的賦值放在了實(shí)例化的方法里,, 出現(xiàn)了cell復(fù)用的問題,每次cell為空的時(shí)候,就會創(chuàng)建一個(gè), 重新賦值,就會出現(xiàn)問題

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
      LoanPartTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"loanPartCell"];
      if (cell == nil) {
            cell = [[LoanPartTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"loanPartCell"];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            cell.model = self.sectionOneNewArray[indexPath.row];
      }
     return cell;
}

把cell的賦值拿到外面去實(shí)現(xiàn), 或者直接采用tableview注冊cell的方法就可以避免這個(gè)問題

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
      LoanPartTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"loanPartCell"];
      if (cell == nil) {
            cell = [[LoanPartTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"loanPartCell"];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
      }
      cell.model = self.sectionOneNewArray[indexPath.row];
     return cell;
}

8. tableview頁面滑動時(shí)卡頓, 來回切換視圖,卡頓時(shí), 優(yōu)化方法

把圖片放在異步線程中加載, 采用緩存的形式, SDWebImage

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{

        if (!([model.iconUrlStr isKindOfClass:[NSNull class]])) {
            NSString *urlStr = [QiNiuDownLoadUrl stringByAppendingString:model.iconUrlStr];
            urlStr =  [urlStr stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
           [self.iconIMV sd_setImageWithURL:[NSURL URLWithString:urlStr] placeholderImage:[UIImage imageNamed:@"home_laba"]]; //小喇叭圖標(biāo)獲取
        }
});
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末嚷节,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子虎锚,更是在濱河造成了極大的恐慌硫痰,老刑警劉巖,帶你破解...
    沈念sama閱讀 219,427評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件窜护,死亡現(xiàn)場離奇詭異效斑,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)柱徙,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,551評論 3 395
  • 文/潘曉璐 我一進(jìn)店門缓屠,熙熙樓的掌柜王于貴愁眉苦臉地迎上來奇昙,“玉大人,你說我怎么就攤上這事敌完〈⒛停” “怎么了?”我有些...
    開封第一講書人閱讀 165,747評論 0 356
  • 文/不壞的土叔 我叫張陵滨溉,是天一觀的道長什湘。 經(jīng)常有香客問我,道長晦攒,這世上最難降的妖魔是什么闽撤? 我笑而不...
    開封第一講書人閱讀 58,939評論 1 295
  • 正文 為了忘掉前任,我火速辦了婚禮勤家,結(jié)果婚禮上腹尖,老公的妹妹穿的比我還像新娘。我一直安慰自己伐脖,他們只是感情好热幔,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,955評論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著讼庇,像睡著了一般绎巨。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上蠕啄,一...
    開封第一講書人閱讀 51,737評論 1 305
  • 那天场勤,我揣著相機(jī)與錄音,去河邊找鬼歼跟。 笑死和媳,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的哈街。 我是一名探鬼主播留瞳,決...
    沈念sama閱讀 40,448評論 3 420
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼骚秦!你這毒婦竟也來了她倘?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,352評論 0 276
  • 序言:老撾萬榮一對情侶失蹤作箍,失蹤者是張志新(化名)和其女友劉穎硬梁,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體胞得,經(jīng)...
    沈念sama閱讀 45,834評論 1 317
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡荧止,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,992評論 3 338
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片罩息。...
    茶點(diǎn)故事閱讀 40,133評論 1 351
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡嗤详,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出瓷炮,到底是詐尸還是另有隱情葱色,我是刑警寧澤,帶...
    沈念sama閱讀 35,815評論 5 346
  • 正文 年R本政府宣布娘香,位于F島的核電站苍狰,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏烘绽。R本人自食惡果不足惜淋昭,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,477評論 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望安接。 院中可真熱鬧翔忽,春花似錦、人聲如沸盏檐。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,022評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽胡野。三九已至材失,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間硫豆,已是汗流浹背龙巨。 一陣腳步聲響...
    開封第一講書人閱讀 33,147評論 1 272
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留熊响,地道東北人旨别。 一個(gè)月前我還...
    沈念sama閱讀 48,398評論 3 373
  • 正文 我出身青樓,卻偏偏與公主長得像汗茄,于是被迫代替她去往敵國和親昼榛。 傳聞我的和親對象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,077評論 2 355