7.真機類比記憶體警告: [[UIApplication sharedApplication] _performMemoryWarning];
8.如果沒法串連模擬器或真機了:刪除DerivedData目錄,並且清空資源回收筒,也許還要重啟xcode4.
1.運行即崩潰,log下面提示:
Couldn't register com.myApp.debug with the bootstrap server. Error: unknown error code. This generally means that another instance of this process was already running or is hung in the debugger.Program received signal: “SIGABRT”.
解決辦法:重啟iphone/ipad系統
2.使用Three20架構,載入圖片失敗,log以下提示:
TTDASSERT failed: 0 == _queue.maxContentLength contentLength <=_queue.maxContentLength
解決辦法:在appDelegate中加入
[[TTURLRequestQueue mainQueue] setMaxContentLength:0];
3.一個object被dealloc之後,其指標還存在,但指向的記憶體偉空,為了防止其他地方判斷該object是否為nil的時候出現bad access問題,就應該立即寫一句object = nil;
4.UINavigationBar的tintColor變了,backItem的顏色不變 的問題解決方案:
@interface UINavigationController (RefreshBackItem)
- (void)refreshBackItem;
@end
@implementation UINavigationController (RefreshBackItem)
- (void)refreshBackItem
{
UINavigationBar *bar = self.navigationBar;
UINavigationItem *backItem = bar.backItem;
NSString *title = [backItem title];
backItem.title = @"";
backItem.title = title;
}
@end
5 清除通知中樞的本程式訊息:
[application cancelAllLocalNotifications];
[application setApplicationIconBadgeNumber:0];
6.- (BOOL) isiPad
{
return [[self model] isEqualToString:@"iPad Simulator"] || [[self platform] rangeOfString:@"iPad"].location == 0;
}
- (BOOL) isRetinaDisplay
{
return ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] == YES && [[UIScreen mainScreen] scale] == 2.00);
}
-(BOOL)isNewiPad
{
return ([self isiPad] && [self isRetinaDisplay]);
}