一,Unknown type name ....
如果是報這個錯誤,多半是你的對象類型沒有被識別,檢查是不是沒有引用對應的庫或者頭文件在你的文件頭部分,還有可能是循環引用導致的,循環引用的解決方法就是
Class A 中用import Class B
Class B的.h頭文件裏用@class A;
.m文件裏再用import
二,EXC_BAD_ACCESS
首先說一下 EXC_BAD_ACCESS 這個錯誤,可以這麼說,90%的錯誤來源在於對一個已經釋放的對象進行release操作。
Objective-C 這段代碼有三個致命問題:1、內存泄露;2、錯誤釋放;3、造成 EXC_BAD_ACCESS 錯誤。
1, NSString* s = [[NSString alloc]initWithString:@”This is a test string”]; 創建了一個 NSString Object,隨後的 s = [s substringFromIndex:[s rangeOfString:@"a"].location]; 執行後,導致創建的對象引用消失,直接造成內存泄露。
2,錯誤釋放。[s release]; 這個問題,原因之一是一個邏輯錯誤,以爲 s 還是我們最初創建的那個 NSString 對象。第二是因爲從 substringFromIndex:(NSUInteger i) 這個方法返回的 NSString 對象,並不需要我們來釋放,它其實是一個被 substringFromIndex 方法標記爲 autorelease 的對象。如果我們強行的釋放了它,那麼會造成 EXC_BAD_ACCESS 問題。
3, EXC_BAD_ACCESS。由於 s 指向的 NSString 對象被標記爲 autorelease, 則在 NSAutoreleasePool 中已有記錄。但是由於我們在前面錯誤的釋放了該對象,則當 [pool drain] 的時候,NSAutoreleasePool 又一次的對它記錄的 s 對象調用了 release 方法,但這個時候 s 已經被釋放不復存在,則直接導致了 EXC_BAD_ACCESS問題。
三:Implicit conversion of an Objective-C pointer to 'int *' is disallowed with ARC
這個就是自己寫錯了 int 不帶指針。。。sb了
四:No unexpired provisioning profiles found that contain any of the keychain's singing certificates
此時需要檢查下,
Organizer->Devices->Provisioning Profiles 中的App Identifier的com及之後部分是否與TARGETS->Summary->iOS Application Target->Bundle Identifier 相符,特別是後面的項目名稱。
五:Incorrect NSStringEncoding value 0x0000 detected. Assuming NSASCIIStringEncoding. Will stop this compatiblity mapping behavior in the near future.
1:當一個字符串爲null時,它不能被正常地使用,否則會報如下錯誤
錯誤案例:當nstrPublicUrl==null時,如果我們寫下如下代碼,就會報如上警告。
//錯誤的案例,nstrPublicUrl==nil時
NSString *nstrUrl = [NSString stringWithFormat:@"%@%@",nstrPublicUrl,ACCOUNT_URL];
說編碼問題的
request.defaultResponseEncoding = NSUTF8StringEncoding
說超時的
request.timeOutSeconds=60;
說數據太大的
反正都沒大的效果
六:[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value '<UIImage: 0x72999e0>' of class 'UIImage'. Note that dictionaries and arrays in property lists must also contain only property values.
NSUserDefault can only store property listed values. 只能保存指定的類型比如NSData、NSString、NSNumber、NSDate、NSArray、NSDictionary如果你要保存其他類型或者自定義類型需要用到archiver.
自己需要寫encode和decode兩個method
參考:http://blog.csdn.net/sjx19871225/article/details/8589204
七:pngcrush caught libpng error,Not a PNG file Could not find file
While reading /XXX/XXX/XXX/img1.png pngcrush caught libpng error: Not a PNG filCould not find file: /Users/XXX/Library/Developer/Xcode/DerivedData/CookBookDemo-cnttcobrbmvbddeiesgsxnfwihfe/Build/Products/Debug-iphoneos/CookBookDemo.app/img1.pngCommand /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
原因解析:
某個公共類或系統提供的控件,存在delegate方法,當創建此公共控件的容器類已經銷燬,
而這個控件對應的服務是在其它run loop中進行的,控件銷燬或者需要進行狀態通知時,依然按照
delegate的指針去通知,則會出現這個問題。
本問題解法:
在第一個AViewcontroller的時候放置UIN avigationController,卻在進入第三個CViewcontroller的時候實現了協議UINavigationDelegate,然後在CViewController中實現了協議的方法 – navigationController:willShowViewController:animated: