草庐IT

unwrapped

全部标签

ios - fatal error : unexpectedly found nil while unwrapping an Optional value - Stanford Calculator

我正在ItunesU上观看斯坦福Swift讲师,但在理解上遇到了一些困难。讲师在某一时刻将String类型转换为Double类型。他是这样做的:returnNSNumberFormatter().numberFromString(display.text!)!.doubleValuedisplay.text是一个UILabel无论如何,当我这样做时,我的应用程序崩溃并且出现以下错误:fatalerror:unexpectedlyfoundnilwhileunwrappinganOptionalvalue当我这样输入字符串时:(display.text!asNSString).doubl

Swift/IOS8 错误 : "fatal error: Can' t unwrap Optional. 无”

我知道这方面已经有几个问题,但我想不通。之前解决的问题表明“profileViewController”为零,但我不知道为什么会这样。UI完全是程序化的,没有IB。获取:"fatalerror:Can'tunwrapOptional.None"在以下代码中的pushViewController()上:classFavoritesViewController:UIViewController{init(nibNamenibNameOrNil:String?,bundlenibBundleOrNil:NSBundle?){super.init(nibName:nibNameOrNil,bu

ios - reloadData() fatal error : unexpectedly found nil while unwrapping an Optional value

应用程序在该行崩溃classImageValueCell:UITableViewCell,UITableViewDelegate,UITableViewDataSource{@IBOutletweakvarimagesList:UITableView!varimageArray:NSArray!overridefuncawakeFromNib(){//super.awakeFromNib()//InitializationcodeimagesList.delegate=self;imagesList.dataSource=self;imageArray=NSArray()imagesL

ios - swift 3 : What's the safest way to unwrap optional values coming from an array?

首先,我初始化变量以保存股票数据varapplePrice:String?vargooglePrice:String?vartwitterPrice:String?varteslaPrice:String?varsamsungPrice:String?varstockPrices=[String]()我从YQL中获取当前股票价格,并将这些值放入一个数组中funcstockFetcher(){Alamofire.request(stockUrl).responseJSON{(responseData)->Voidinif((responseData.result.value)!=nil)

ios - self.view?.presentScene : unexpectedly found nil while unwrapping an Optional value (Swift)

我正在尝试切换场景,但我的应用程序崩溃并出现此错误:crashcrashfatalerror:unexpectedlyfoundnilwhileunwrappinganOptionalvalue(lldb)这是我切换场景的代码:funcswitchscenes(){ifdisplay>=2{Player.removeFromParent()PlayerRight.removeFromParent()PlayerLeft.removeFromParent()fireHair.removeFromParent()fireHairRight.removeFromParent()fireHai

ios - Swift 中的 UIView 子类 : IBOutlet is found nil while unwrapping

我正在尝试通过子类化UIView在Swift中创建自定义View,并且我有一个名为MyViewPanel.xib的View板,其类已分配给我的自定义View。实现如下:importUIKit@IBDesignableclassMyCustomView:UIView{@IBOutletweakvartitle:UILabel!varquestion:Question{didSet{print("didsetquestion,titleis:\(question.title)")}}overrideinit(frame:CGRect){super.init(frame:frame)}req

ios - Swift UITableViewCell detailTextLabel.text 抛出错误 'fatal error: Can' t unwrap Optional.None'

这是生成表格View的Swift代码。我正在尝试设置带有详细信息标签的tableView。我相信问题的产生是因为if(cell==nil){println("1")cell=UITableViewCell(style:.Subtitle,reuseIdentifier:"CellSubtitle")//cell=tableViewCell}永远不会被调用,因此单元格永远不会使用UITableViewCellStyle.Subtitle样式进行初始化。以下是该方法所需的代码:functableView(tableView:UITableView!,cellForRowAtIndexPat

ios - fatal error : unexpectedly found nil while unwrapping an Optional value in UITableViewCell

问了类似的问题here但这并不能为我解决这个问题。我添加了tableView在ViewController.使用它的数据源和委托(delegate)扩展类并为其添加所需的方法。然后我在此表中创建了一个原型(prototype)单元格(不是单独的.xib)并为此创建了一个类TableViewCell并收集了@IBOutlet:@IBOutletweakvartitleOfAccount:UILabel!@IBOutletweakvarlastModified:UILabel!@IBOutletweakvaraccountImage:UIImageView!@IBOutletweakvar

ios - ( swift )PrepareForSegue : fatal error: unexpectedly found nil while unwrapping an Optional value

细节ViewController:@IBOutletvarselectedBundesland:UILabel!表格ViewController:overridefuncprepareForSegue(segue:UIStoryboardSegue!,sender:AnyObject!){if(segue.identifier=="BackToCalculator"){varvc:FirstViewController=segue.destinationViewControllerasFirstViewControllervc.selectedBundesland.text="Test

ios - ( swift )PrepareForSegue : fatal error: unexpectedly found nil while unwrapping an Optional value

细节ViewController:@IBOutletvarselectedBundesland:UILabel!表格ViewController:overridefuncprepareForSegue(segue:UIStoryboardSegue!,sender:AnyObject!){if(segue.identifier=="BackToCalculator"){varvc:FirstViewController=segue.destinationViewControllerasFirstViewControllervc.selectedBundesland.text="Test