草庐IT

concatenated_value

全部标签

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

objective-c - 一些for循环的问题 - - "Cannot subscript a value of type ' Double' with an index of type 'int' "errors

我在有索引的地方收到很多“无法使用‘int’类型的索引下标‘Double’类型的值”错误?阵列?像这样此代码取自Obj-C,并尽可能翻译成Swift,但我不熟悉某些语法。我清理了for循环,但一些Obj-C语法仍然存在。你能帮我清理/重构我的代码吗?importUIKitimportFoundationimportAVFoundationletminFramesForFilterToSettle=10enumCurrentState{casestatePausedcasestateSampling}classViewController:UIViewController,AVCaptu

ios - NSDictionary, (key :AnyObject, value:AnyObject) 没有成员名下标

我正在为IOS学习swift,当我在youtube上做巡回演出时(Swift:SkipWilson的Swift:使用外部数据库和API)对于外部数据库,我找到了部分:service=PostService()service.getPosts{(response)inself.loadPosts(response["posts"]!asNSDictionary)}funcloadPosts(posts:NSDictionary){forpostinposts{varid=(post["Post"]["id"]asString)vartitle=post["Post"]!["title"]

arrays - 线程 1 : EXE_BAD_INSTRUCTION | assigning an array of objects values

我制作了一个对象数组列表并尝试定义其中一个,起初它很好但是当我尝试调用定义对象的函数时它会给我一个错误“Thread1:EXC_BAD_INSTRUCTION(code=EXC_I386_INVOP,子代码0x0)我的代码是这样的:classColor{varRed:Bool=truefuncsetRed(input:Bool){self.Red=input}和classViewController:UIViewController{//CreatetheobjectarrayvarColors:[Color]=[]//asignvaluestothearrayinsideafunct

ios - swift : How can i obtain a documented value for UIImagePickerControllerMediaType

目前要知道什么是媒体类型,如果用户选择图像到相机胶卷或拍摄新照片,我将获得“public.image”,如果是电影,则获得“public.movi​​e”。我阅读了UIImagePickerControllerMediaType的Apple文档,我看到了这个:letUIImagePickerControllerMediaType:String常量UIImagePickerControllerMediaTypeSpecifiesthemediatypeselectedbytheuser.ThevalueforthiskeyisanNSStringobjectcontainingatype

swift - 代码 9 : Cannot convert value of type '[String : Any]' to expected argument type '[NSAttributedStringKey : Any]?'

我有一个自定义的UIOutlineLabel类,它在标签内的文本周围绘制轮廓。自更新到Swift4后,我收到以下错误:无法将类型“[String:Any]”的值转换为预期的参数类型“[NSAttributedStringKey:Any]?”。我尝试将strokeTextAttributes更改为:as![NSAttributedStringKey:Any]但这会导致运行时错误。还有“UIOutlineLabelsetOutlineWidth已弃用并将在Swift4中删除”和“UIOutlineLabelsetOutlineColor已弃用并将在Swift4中删除”的Swift语言运行时

swift - 由于 'value' 保护级别开关语句,Alamorfire 'internal' 无法访问

我一直在将一些swift更新到Alamofire5时遇到问题。我已经阅读了有关Alamofire如何迁移到结果类型here的信息。以及value为何不在Alamofire的公共(public)界面中。我无法按照建议将其放入switch语句中。非常感谢任何帮助。AF.request(downloadurl).responseJSON{responseinletresult=response.resultifletdict=result.valueas?Dictionary{ifletdatas=dict["data"]as?[[String:Any]]{fordataindatas{if