IOS開發問題匯總

來源:互聯網
上載者:User

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]);
}  

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.