IOS迅速,使用String和UIButton随机崩溃

时间:2015-11-23 10:41:27

标签: ios swift 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);
<{1>} _generateTitleButton title:String由于某种原因导致下一个字符串:

保留\ 0release \ 0autorelease \ 0retainCount \臭氧应用\ 0hash \ 0superclass \ 0description \ 0debugDescription \ 0scrollViewDidScroll:\ 0scrollViewDidZoom:\ 0scrollViewWillBeginDragging:\ 0scrollViewWillEndDragging:withVelocity:targetContentOffset:\ 0scrollViewDidEndDragging:willDecelerate:\ 0scrollViewWillBeginDecelerating:\ 0scrollViewDidEndDecelerating: \ 0scrollViewDidEndScrollingAnimation:\ 0viewForZoomingInScrollView:\ 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:moveRowA tIndexPath: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)>

}

p.s该类是单身static var instance = CalendarMeetingViewTitle()

我最近做的唯一改变是添加推送通知支持,解析应用程序并将按钮目标更改为另一种方法,它在过去几个月中一直有效

有什么想法吗?

谢谢!

0 个答案:

没有答案