草庐IT

concatenated_value

全部标签

xcode - 无法将类型 'value' 的值转换为预期的参数类型 'argument '

我目前正在尝试将我的SwiftiOS应用程序转换为Swift2。我已经删除了99%的编译器错误,但这个错误仍然存​​在:Cannotconvertvalueoftype'(CMAltitudeData!,NSError!)->Void'toexpectedargumenttype'CMAltitudeHandler'(aka'(Optional,Optional)->()')这是对这个函数的响应:funcstartAltimeterUpdate(){self.altimeter.startRelativeAltitudeUpdatesToQueue(NSOperationQueue.c

ios - Firebase 对 snapshot.value 的排序说明

希望有人能帮助我理解Firebase快照和排序。为什么如果您在FirebaseDBRef上查询OrderedByChild,snapshot.value会返回Firebase数据库中显示的内容(使用浏览器),但如果您执行forsnapinsnapshot.children{},值会显示已排序。只是想澄清为什么会发生这种情况。让我用例子来解释。letdinoRef=rootRef.child("dino")letquery=dinoRef.queryOrderedByChild("dimensions/height")query.observeSingleEventOfType(.Val

iOS swift : How to store the index of all duplicate values in array?

让我们以我有这个数组为例:letdates=["01/02/16","02/02/16","03/02/16","01/02/16","02/02/16"]我喜欢做的是将每个String日期作为键存储在字典中,对于每个重复的键,我喜欢将其索引存储为数组,并将其与重复键。例如,01/02/16出现在索引0和3处。02/02/16出现在索引1和4处。我喜欢这样的字典:["01/02/16":[0,3],"02/02/16":[2,4],"03/02/16":[1]]我知道如何跟踪有多少重复条目是这样的:letdates=["01/02/16","01/02/16","02/02/16","

swift 4 : Escaping closures can only capture inout parameters explicitly by value

我一直在将我的代码从Swift2迁移到Swift4。我有以下代码在Swift2中运行良好:funcfetchUserThumbnailAvatar(_task:inoutURLSessionTask?,completion:@escaping(_image:UIImage?)->()){fetchUserAvatar(Session.currentUser?.avatar?.thumbnailURLasURL???URL(string:"")!,externalUrl:URL(string:thumbnailAvatar)??URL(string:"")!,&task,completi

ios - 错误 : Cannot subscript a value of type '[String : Any]' with an index of type 'UIImagePickerController.InfoKey'

这个问题在这里已经有了答案:Cannotsubscriptavalueoftype'[String:Any]'withanindexoftype'UIImagePickerController.InfoKey'(8个答案)关闭3年前。我正在尝试通过CoreML重建用于图像检测的Apple测试应用程序,但出现错误:Cannotsubscriptavalueoftype'[String:Any]'withanindexoftype'UIImagePickerController.InfoKeyextensionImageClassificationViewController:UIImag

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 中的 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,并在尽可能多的位置放置感叹号和问号。我从建议的帖子中尝试的所有事情都没有帮助。