草庐IT

fill_values

全部标签

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 中的 UIPickerView 子类 : error optional value in viewForRow

我想继承UIPickerView以创建自定义DatePicker。我试过了,但是Swift中有一个错误说:unexpectedlyfoundnilwhileunwrappinganOptionalvalue在这一行:(view.viewWithTag(1)asUILabel).text=array[row]代码如下:classMyPickerView:UIPickerView,UIPickerViewDataSource,UIPickerViewDelegate{letarray=["one","two","three"]requiredinit(coderaDecoder:NSCod

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}}

ios - Xcode 错误 "value of type ' [UIViewController ]' has no member ' firstObject'”

我正在尝试创建thisGitHubrepository的Swift版本.我首先将所有代码从Objective-C直接转移到Swift,这导致了很多错误(321行文件中有60个错误)。对于这一行特定的代码self.currentViewController=self.childViewControllers.firstObject我收到这个错误:Valueoftype'[UIViewController]'hasnomember'firstObject'我试过添加as!UIViewController,并在尽可能多的位置放置感叹号和问号。我从建议的帖子中尝试的所有事情都没有帮助。

swift - 错误 : Variable with getter/setter cannot have an initial value

如何修复此错误?Variablewithgetter/settercannothaveaninitialvalue这是我的代码:functableView(tableView:UITableView,cellForRowAtIndexPathindexPath:NSIndexPath)->UITableViewCell{varcell:UITableViewCell=tableview.dequeueReusableCellWithIdentifier("cell")asUITableViewCell{//Errorcell.textLabel?.text=self.items[ind

swift - 线程 10 : Fatal error: Unexpectedly found nil while unwrapping an Optional value

我正在尝试进行服务调用以获取用户详细信息,但出现此错误:线程10:fatalerror:在展开可选值时意外发现nil从这段代码:leturlString="http://myURL.com/getInfo/getAccountTransactions/{accountPublicKey}"print(urlString)letrequestUrl=URL(string:urlString)letrequestURL=URLRequest(url:requestUrl!)当我将代码包装在一个守卫中时,让代码不会被执行,因为它发现nil,我不确定为什么,因为URL字符串永远不会是nill,

ios - 打印值(value) $0

我有一行代码看起来像这样......letmyMessages=theObjects.filter{$0.myJid.user==user.JID.user}现在我想打印$0.myJid.user的值。我怎样才能做到这一点……? 最佳答案 另一种选择:letmyMessages=theObjects.filter{print($0.myJid.user);return$0.myJid.user==user.JID.user} 关于ios-打印值(value)$0,我们在StackOver

uitableview - fetchedResultsController核心数据 fatal error : unexpectedly found nil while unwrapping an Optional value

我知道有无数的问题都出现了同样的错误,但似乎没有一个解决方案有效。我想制作一个博客阅读器应用程序,用于从CoreData保存和获取数据。我能够将JSON结果保存到CoreData中,但是当我尝试检索它以在tableView中显示时,它崩溃并显示fatalerror:unexpectedlyfoundnilwhileunwrappinganOptionalvalueonlineletentity=NSEntityDescription.entityForName("博客",inManagedObjectContext:self.managedObjectContext!)这是我的代码:i

swift - 'anyObject' 不可转换为 'Dictionary<key, value>]'

您好,我想使用NSUserDefaut获取对象类型字典:varfavoritePlace=NSUserDefaults.standardUserDefaults().objectForKey("savePlace")!as[Dictionary]但我收到错误“anyObject”无法转换为“Dictionary]”我也试试:varfavoritePlace=NSUserDefaults.standardUserDefaults().objectForKey("savePlace")!as[Dictionary()]但这也行不通。任何人都知道我该怎么做?谢谢!

ios - mapView.addAnnotation() 表示 "unexpectedly found nil while unwrapping an Optional value"

我尝试从tableView单元格的地址转到mapView并在map上显示图钉。我确定我的代码中的所有内容都不为零。但是Xcode说我的oldValue是nil(在didSet{}中)。我不知道如何解决它。以下是我的代码:classMapViewController:UIViewController,MKMapViewDelegate{@IBOutletweakvarmapView:MKMapView!{didSet{mapView.mapType=.StandardmapView.delegate=self}}varlocation:CLLocation?{didSet{clearWa