草庐IT

unwrapped

全部标签

ios - 从 NSData 创建 UIImage 时出现 "fatal error: unexpectedly found nil while unwrapping an Optional value"

首先,我将一张图片转换为NSData,并借助fmdb(飞肉数据库)以sqliteblob的形式插入到sqlite数据库中。然后我取回NSData,但是在将NSData转换为UIImage时出现错误“fatalerror:在展开可选值时意外发现nil”。varimageData=String()letcountryDB=FMDatabase(path:databasePathasString)ifcountryDB.open(){letquerySQL="SELECTUSERIMAGEFROMUSERINFOWHEREID=\((1))"letresults:FMResultSet?=c

android - Parceler unwrap 提供错误的数据

我正在使用parceler实现Parcelable接口(interface)的库。我有这样的模型@Parcel(Parcel.Serialization.BEAN)publicclassAds{privateLongid;privateStringtitle;privateStringdescription;privateAdsTypeadsType;privateStringphone;privateStringemail;privateStringcity;privateLongcategoryId;privateArrayListcreationDate;//TODOremove

c++ - C++ 中的连续角(matlab 中的 eq unwrap 函数)

我想这并不难,但我已经坚持了一段时间。我有一个可以双向旋转的关节。传感器为我提供了-pi和+pi范围内的关节角度。我想在-infinity和+infinity范围内转换它。这意味着如果关节永远顺时针旋转,角度将从0开始,然后增加到无穷大。在matlab中,unwrap函数做得很好:newAngle=unwrap([previousAnglenewAngle]);previousAngle=newAngle;注意:假设角度没有大跳跃,肯定没有比PI好。注:问之前真的很认真的看了...谢谢! 最佳答案 经过一番努力,想出了这个。似乎工作

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 - Swift - 获取国家列表 -> fatal error : Can't unwrap Optional. 无

我几天前问过如何在Swift中获取国家列表,你解决了它的第一部分(这里:Swift-Getlistofcountries),但我无法获得最终的国家列表,因为它给出了一个错误:varcountries:NSMutableArray=NSMutableArray()countries=NSMutableArray(capacity:(NSLocale.ISOCountryCodes().count))forcountryCode:AnyObjectinNSLocale.ISOCountryCodes(){letdictionary:NSDictionary=NSDictionary(obj

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