草庐IT

Unexpectedly

全部标签

ios - 为什么 UILabel.text 会导致 “fatal error: unexpectedly found nil while unwrapping an Optional value” ?

我已经阅读了这个问题的几个答案,并尝试了所有建议但没有成功。我是swift的新手,正在使用Swift、PHP和MySQL构建应用程序。我在用户登录到应用程序后收到错误消息,系统应该使用UILabel.text通过标签显示用户名。为UILabel.text变量设置值时发生错误。我的代码包含在下面。我尝试在其他页面上对值进行硬编码,但在我的整个项目中都遇到了这个错误。importUIKitclassHomeViewController:UITabBarController{@IBOutletvarusernameLbl:UILabel!overridefuncviewDidLoad(){s

ios - 如何修复 "Xcode quit unexpectedly while using the libclang.dylib plug-in."?

每次启动xCode(5.1.1)后,我每次都会遇到这个问题。删除了用户数据,关闭了源代码控制(如某些帖子所建议的),没有效果,仍然崩溃(同时显示索引......永远不会完成)。甚至重新安装xCode,没有任何效果,还是一样。有人修复过这样的xCode吗?这是崩溃的线程:Thread7Crashed::Dispatchqueue:IDEIndexPCHCreationLock0libclang.dylib0x00000001080c60d9voidllvm::BitstreamWriter::EmitRecordWithAbbrevImpl(unsignedint,llvm::Small

ios - "Unexpectedly found nil"但已使用 "print"成功检查该值。 swift

收到“意外发现nil”错误,但在检查值时-它在那里:overridefuncviewDidLoad(){super.viewDidLoad()ifwhichLink=="officiallink"{leturlStr=videoGame.offLink!leturl=NSURL(string:urlStr)!letrequest=NSURLRequest(URL:url)webView.loadRequest(request)}elseifwhichLink=="mobygamelink"{print("yoyoyo,valueishere!\(videoGame.mgLink)")l

uitableview - swift - 错误 : unexpectedly found nil while unwrapping an optional value

我一直在用Swift制作应用程序,但我的TableViewController类中一直出现错误。我找不到任何方法来解决此问题并不断收到此错误:overridefunctableView(tableView:UITableView?,cellForRowAtIndexPathindexPath:NSIndexPath!)->UITableViewCell!{letcell:TextTableViewCell=tableView!.dequeueReusableCellWithIdentifier("Cell",forIndexPath:indexPath!)asTextTableView

swift - 从 Parse.com 检索 PFFile 时为 "unexpectedly found nil while unwrapping an Optional value"

我在检索存储在Parse.com中的PFFile时遇到问题letuser=PFUser.currentUser()letuserImageFile=user["profileImage"]asPFFileuserImageFile.getDataInBackgroundWithBlock{(imageData:NSData!,error:NSError!)->Voidiniferror==nil{ifimageData!=nil{letimage=UIImage(data:imageData)self.profileImage.image=image}}}错误从第二行开始。“profi

ios - 在 Swift ios 中使用 vImageBuffer_initWithCGImage 时出现 "fatal error: unexpectedly found nil while unwrapping an Optional value"

我正在使用SwiftiOS8并尝试将UIImage转换为vImage_Buffer以使用Accelerate.framework执行操作。我正在尝试使用vImageBuffer_initWithCGImage进行转换,这是我尝试过的代码:funcinitvImageBufferwithUIImage(image:UIImage)->vImage_Buffer{varCGImg:CGImageRef=sunset.CGImagevarinProvider:CGDataProviderRef=CGImageGetDataProvider(CGImg)varinBitmapData:CFDa

swift - 在 swift 中解析 JSON 抛出 'fatal error: unexpectedly found nil while unwrapping an Optional value'

我正在尝试获取json对象,但无法获取这是我的代码funcloadShots(completion:((AnyObject)->Void)!){varurlString="http://ip.jsontest.com/";letsession=NSURLSession.sharedSession()letshotsUrl=NSURL(string:urlString)vartask=session.dataTaskWithURL(shotsUrl!){(data,response,error)->Voidiniferror!=nil{println(error.localizedDes

ios - fatal error : unexpectedly found nil while unwrapping an Optional value using AVAudio

我有两个项目,使用相同的代码,但下面一行:player=AVAudioPlayer(contentsOfURL:NSURL(string:fileLocation),error:&error)仅在一个项目中返回此错误:fatalerror:unexpectedlyfoundnilunwrappinganOptionalvalue另一个项目运行没有错误。我正在尝试播放声音。importUIKitimportAVFoundationclassViewController:UIViewController{varplayer:AVAudioPlayer=AVAudioPlayer()over

swift - SceneKit—— fatal error : unexpectedly found nil while unwrapping an Optional value when getting child node

所以我试图在我的SceneKit/Swift项目中使用3D对象(.dae1.4,使用Cinema4Dr13导出)。我留下了提供的代码并进行了更改:letscene=SCNScene(named:"art.scnassets/ship.dae")!适合我的:letscene=SCNScene(named:"art.scnassets/pyramid.dae")!我确实也将文件导入到它应该位于的项目中(在art.scnassets中)。我可以像默认飞船一样预览文件,所以这应该是正确的。我也改了:letship=scene.rootNode.childNodeWithName("ship",

ios - Swift:比较隐式展开的可选结果为 "unexpectedly found nil while unwrapping an Optional values"

如果得到这个类并且想根据值比较它的实例classLocationOption:NSObject{varname:String!varradius:Int!varvalue:String!overridefuncisEqual(object:AnyObject?)->Bool{ifletotherOption=objectas?LocationOption{return(self.name==otherOption.name)&&(self.radius==otherOption.radius)&&(self.value==otherOption.value)}returnfalse}}