2015-11-23 44 views
0

我有我的應用
IOS迅速,隨機崩潰與字符串和UIButton的

環境奇怪的問題:Xcode的7.1.1

我在寫迅速且隨機崩潰,我的下一個功能:

private func _generateTitleButton(frame: CGRect,title:String)->UIButton{ 
    //Font Property: 
    let buttonFont = UIFont(name: "Roboto-Regular", size: 13)!; 

    let button = UIButton(frame:frame); 
    //crash point 
    button.setTitle(title, forState: .Normal); 
    button.setTitleColor(UIColor.whiteColor(), forState: .Normal); 
    button.titleLabel!.font = buttonFont; 
    button.contentMode = UIViewContentMode.Top; 
    button.addTarget(self, action: "titleButtonClicked:", forControlEvents: .TouchDown); 
    return button; 
} 

我召喚時的實際字符串是一個枚舉原始值的函數:

private enum titleButtonsText : String{ 
    case NOTES = "NOTES"; 
    case PEOPLE = "PEOPLE"; 
    case INFO = "INFO"; 
} 

功能用途:

self.infoButton = self._generateTitleButton(CGRect(origin: CGPoint(x: baseX, y: originY), size: buttonSize),title:titleButtonsText.INFO.rawValue); 
_generateTitleButtontitle:String

是出於某種原因,下一個字符串:

保留\ 0release \ 0autorelease \ 0retainCount \臭氧應用\ 0hash \ 0superclass \ 0description \ 0debugDescription \ 0scrollViewDidScroll:\ 0scrollViewDidZoom:\ 0scrollViewWillBeginDragging:\ 0scrollViewWillEndDragging:withVelocity:targetContentOffset:\ 0scrollViewDidEndDragging:willDecelerate:\ 0scrollViewWillBeginDecelerating:\ 0scrollViewDidEndDecelerating:\ 0scrollViewDidEndScrollingAnimation:\ 0viewForZ oomingInScrollView:\ 0scrollViewWillBeginZooming:withView:\ 0scrollViewDidEndZooming:withView:atScale:\ 0scrollViewShouldScrollToTop:\ 0scrollViewDidScrollToTop:\ 0_performScrollTest:withIterations:rowsToScroll:inComponent:\ 0tableView:numberOfRowsInSection:\ 0tableView:的cellForRowAtIndexPath:\ 0numberOfSectionsInTableView:\ 0tableView:titleForHeaderInSection:\ 0tableView: titleForFooterInSection:\ 0tableView:canEditRowAtIndexPath:\ 0tableView:canMoveRowAtIndexPath:\ 0sectionIndexTitlesForTableView:\ 0tableView:sectionForSectionIndexTitle:atIndex:\ 0tableView:commitEditingStyle:forRowAtIndexPath:\ 0tableView:moveRowAtIndexPath:toIndexPath:\ 0setSoundsEnabled:\ 0reload \ 0reloadDataForColumn

的打印self在撞車點:

self = 0x0000000000000010 { 
    UIKit.UIView = { 
    UIKit.UIResponder = { 
     ObjectiveC.NSObject = {} 
    } 
    } 
    backButton = <read memory from 0x178 failed (0 of 8 bytes read)> 

    infoButton = <read memory from 0x180 failed (0 of 8 bytes read)> 

    peopleButton = <read memory from 0x188 failed (0 of 8 bytes read)> 

    notesButton = <read memory from 0x190 failed (0 of 8 bytes read)> 

    _border = <read memory from 0x198 failed (0 of 8 bytes read)> 

    title = <read memory from 0x1a0 failed (0 of 8 bytes read)> 

    saveButton = <read memory from 0x1a8 failed (0 of 8 bytes read)> 

    deleteButton = <read memory from 0x1b0 failed (0 of 8 bytes read)> 

    titleLabel = <read memory from 0x1b8 failed (0 of 8 bytes read)> 

} 

PS類是單static var instance = CalendarMeetingViewTitle()

我最近唯一的變化是添加推送通知的支持與解析的應用程序和按鈕對象改變到另一種方法,它的工作至今過去幾個月

任何想法?

謝謝!

回答

0

我找到了解決方案,出於某種原因,它與單身人士。

改變

static var instance = CalendarMeetingViewTitle() 

private static var _instance : CalendarMeetingViewTitle? 
static var instance :CalendarMeetingViewTitle{ 
    if _instance == nil{ 
     _instance = CalendarMeetingViewTitle(); 
    } 
    return _instance!; 
} 

解決問題