1.xcode運(yùn)行到真機(jī)報(bào)錯(cuò)While reading xx.png pngcrush caught libpng
原因1. 是提示的png并不是ps導(dǎo)出的png,而是手動(dòng)修改jpeg后綴名為png得院,在模擬器上不會(huì)報(bào)錯(cuò)咳胃,但在真機(jī)物延,
不識(shí)別這種所謂 的“png”圖片门驾。(隨便批下美工)
原因2:這是因?yàn)閜ng圖片的問題鹉戚,png圖片在存儲(chǔ)的時(shí)候有一個(gè)NOT INTERLACED/INTERLACED(無(wú)交錯(cuò)/交錯(cuò))
的選項(xiàng)谭贪,因?yàn)樵O(shè)計(jì)師在切圖的時(shí)候的存儲(chǔ)錯(cuò)誤斤蔓,圖片在XCode中就會(huì)報(bào)這個(gè)錯(cuò)誤隆圆,但是還是會(huì)編譯成功并運(yùn)行漱挚,請(qǐng)?jiān)O(shè)計(jì)師
將圖片重新按無(wú)交錯(cuò)存儲(chǔ)就行了。
解決方案:
用ps重新導(dǎo)出png就ok了
參考 http://zfanxu.iteye.com/blog/1974113
The file “XXX” couldn’t be opened because you don’t have permission to view it.
shift+command+k重新運(yùn)行然后就可以了渺氧,我的是這樣解決的旨涝。
2.AFNetworking報(bào)錯(cuò):(415 Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: un
參考:http://blog.csdn.net/liqunzhang/article/details/70256313
3.Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "PhoneCameraController" nib but the view outlet was not set.'
先建的controller類,后加的xib侣背,沒有將view與控制器建立關(guān)系白华。
從File's Owner向View拖線慨默。
4、在升級(jí)到Xcode9 遇到以下錯(cuò)誤:Compiling IB documents for earlier than iOS 7 is no longer supported
將Development Target調(diào)整到iOS7以后到版本:
5弧腥、-(void)scrollViewDidZoom:(UIScrollView *)scrollView不執(zhí)行
做scrollView縮放功能時(shí)代理設(shè)置了厦取,但是self.scrollView.minimumZoomScale = minZoomScale;
self.scrollView.maximumZoomScale = 1.0f未設(shè)置
6、iOS經(jīng)典錯(cuò)誤Undefined symbols for architecture XXX:
原因:編譯項(xiàng)目時(shí)管搪,因?yàn)殪o態(tài)庫(kù)沒有鏈接進(jìn)工程虾攻,所以靜態(tài)庫(kù)就不會(huì)參與編譯,而項(xiàng)目某些文件(.m文件)又引用(或者說依賴)了靜態(tài)庫(kù)更鲁,所以自然會(huì)報(bào)錯(cuò)霎箍,而報(bào)的錯(cuò)就是經(jīng)典的 Undefined symbols for architecture XXX這一類的錯(cuò)誤。
解決方案:下次遇到這類問題澡为,我們只需要在Linked Frameworks and Libraries 中添加指定的靜態(tài)庫(kù)即可漂坏!
參考:http://www.cocoachina.com/ios/20170221/18737.html
7、升級(jí)完xcode后報(bào)錯(cuò):
error: failed to remove /Users/ ....../xxx.app/Info.plist: “Info.plist” couldn’t be removed.
Command + shift + K就可以了
8缀壤、使用百度地圖SDK報(bào)錯(cuò):[BMKSearchReverseGeoCodeModel bmk_objectWithKeyValues:]: unrecognized selector sent to class
項(xiàng)目缺少配置
添加官方說明的庫(kù)及工程配置樊拓。
9纠亚、百度地圖manager start failed : info.plist 中必須添加 Bundle display name
用source code方式打開info.plist并添加:
<key>CFBundleDisplayName</key>
<string>項(xiàng)目名</string>
10塘慕、手勢(shì)與tableview點(diǎn)擊事件沖突:
1、父類事件設(shè)置代理
UIGestureRecognizer *tapGesture 蒂胞。图呢。。
tapGesture.delegate = self;
2骗随、覆蓋方法
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {
return NO;
}
return YES;
}
就可以了
11蛤织、
CGImageRef imgRef = self.image.CGImage;
CGFloat w = CGImageGetWidth(imgRef);
CGFloat h = CGImageGetHeight(imgRef);
UIGraphicsBeginImageContextWithOptions(self.image.size, NO, 0);
[self.image drawInRect:CGRectMake(0, 0, w, h)];
繪圖時(shí)報(bào)如下錯(cuò):
CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SH
最后原因是self.image為nil。
12鸿染、Permission to debug xxxx(app) was denied. The app must be signed with a development identity (e.g. iOS Developer).
在用Instruments 測(cè)試程序的時(shí)候報(bào)這樣的錯(cuò)指蚜。
這里修改Profile 為debug模式解決。
13涨椒、 -[__NSCFConstantString size]: unrecognized selector sent to instance 0x10213a758
原因:因?yàn)槭褂脮r(shí)候的類型和初始化的對(duì)象類型不匹配造成的摊鸡。
粗心將字符串直接賦值給了image[self.bottomBtn setImage:@"image" forState:UIControlStateNormal];
改:[self.bottomBtn setImage:[UIImage imageNamed:@"image"] forState:UIControlStateNormal];
14、導(dǎo)入opencv庫(kù)后報(bào)錯(cuò)
Showing All Messages
"std::__1::num_get<char, std::__1::istreambuf_iterator<char, std::__1::char_traits<char> > >::id", referenced from:
std::__1::basic_istream<char, std::__1::char_traits<char> >::operator>>(unsigned long&) in opencv2(persistence.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::reserve(unsigned long)", referenced from:
base64::make_base64_header(char const*) in opencv2(persistence.o)
icvXMLParseBase64(CvFileStorage*, char*, CvFileNode*) in opencv2(persistence.o)
icvYMLParseBase64(CvFileStorage*, char*, int, CvFileNode*) in opencv2(persistence.o)
icvJSONParseValue(CvFileStorage*, char*, CvFileNode*) in opencv2(persistence.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::rfind(char, unsigned long) const", referenced from:
_cvOpenFileStorage in opencv2(persistence.o)
"typeinfo for std::__1::ios_base", referenced from:
typeinfo for std::__1::basic_ios<char, std::__1::char_traits<char> > in opencv2(ocl.o)
"std::__1::locale::locale()", referenced from:
......
添加libc++.tbd解決蚕冬。
15.運(yùn)行騰訊云demo報(bào)錯(cuò)
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_TXSpeed", referenced from:
objc-class-ref in VideoEditViewController.o
"_OBJC_CLASS_$_TXVideoEditer", referenced from:
objc-class-ref in VideoEditViewController.o
"_OBJC_CLASS_$_TXPreviewParam", referenced from:
objc-class-ref in VideoEditPrevController.o
objc-class-ref in VideoEditViewController.o
.....
objc-class-ref in ZFPlayerView.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
原因
鏈接的framework不見了免猾,工程本地目錄里還在,重新添加framework鏈接