草庐IT

my_member

全部标签

swift - Swift 3 开发快照中的 POST 请求给出 "ambiguous reference to member ' dataTask(带有 :completionHandler:)'

我正在尝试在Swift3开发快照中发出POST请求,但由于某种原因,对NSURLSession.dataTask的调用失败,标题中出现错误。这是我使用的代码:importFoundationvarerr:NSError?varparams:Dictionaryvarurl:String="http://notreal.com"varrequest=NSMutableURLRequest(url:NSURL(string:url)!)varsession=NSURLSession.shared()request.httpMethod="POST"request.httpBody=tryN

swift - "Value of type ' AuthDataResult ' has no member ' uid '"错误

有人可以帮我解决这个问题吗?第一个错误是“‘authdataresult’类型的值没有成员‘uid’”。Auth.auth()?.signIn(withEmail:email,password:password,completion:所以我删除了问号来解决问题并且成功了!但在那之后,又出现了另一个错误,它说“‘AuthDataResult’类型的值没有成员‘uid’”。我知道,这很烦人。self.userUid=user.uid哦,还有另一个错误,它在我的项目中已经存在很长时间了,所以现在我忽略了它,但是如果有人知道如何修复它,请告诉我。错误是“只能声明实例方法@ibaction”。@

swift - 为什么会出现 "Static member ' .. .' cannot be used on instance of type ' .. .'"错误?

这是在实例方法中直接使用静态成员的方法:publicstructRankSet{privateletrankSet:UInt8staticletcounts:[UInt8]=[0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,...//Moreofthesame4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8]publicvarcount:Int{get{//TheerrorisonthefollowinglinereturnInt(counts[Int(rankSet)])}}}Swift产生以下错误:Staticmember'counts'cannotb

ios - Swift 和 Facebook 登录 : my UIViewController does not conform to FBSDKLoginButtonDelegate

即使Facebook教程说不需要header,我在通过.swift文件中的简单导入框架添加FBSDK功能时也遇到了问题。因此,我遵循了本教程:http://www.brianjcoleman.com/tutorial-how-to-use-login-in-facebook-sdk-4-0-for-swift/使用swift6.3SDKFacebook4.1SDK但是我有两个问题FBLoginViewViewControllerdoesnotconformtoFBSDKLoginButtonDelegateCannotassignavalueoftype'FBLoginViewView

ios - [NSObject : AnyObject] ?' does not have a member named ' subscript' in Xcode 6 Beta 6

我正在使用Swift的Xcode6Beta6构建应用程序,但我不断收到此错误:[NSObject:AnyObject]?'doesnothaveamembernamed'subscript'我不知道如何解决这个问题。我试过看这个[NSObject:AnyObject]?'doesnothaveamembernamed'subscript'errorinXcode6beta6但我仍然不明白那是如何解决问题的。如果有人能向我解释这一点,那就太好了。如果你想看我的代码,这里是:importUIKitclassTimelineTableViewController:UITableViewCon

尝试访问字典时出现 Swift 错误 : `Could not find member ' subscript'`

这不会编译:我尝试了几种不同的方法;声明字典的不同方式,更改其类型以匹配数据的嵌套性。我还尝试明确地说我的Any是一个集合,因此它可以被下标。没有骰子。importUIKitimportFoundationclassCurrencyManager{varresponse=Dictionary()varsymbols=[]structStatic{staticvartoken:dispatch_once_t=0staticvarinstance:CurrencyManager?}classvarshared:CurrencyManager{dispatch_once(&Static.to

swift - "Ambiguous reference to member map"尝试追加/替换数组元素时

几个SO帖子likethis处理相同的错误消息,但这些解决方案均无效。看起来这可能是误导性错误消息的情况。下面的代码会为映射调用生成“对成员映射的不明确引用”错误。有人知道为什么吗?funcsaveUser(user:User){varuserDicts=masterDict["users"]as![[String:AnyObject]]letnewDict=user.getDict()//Replacematchingelementwithletreplaced=falsemasterDict["users"]=userDicts.map{if($0["id"]asString!==

ios - 如何在 Swift 中使用 "Show my current location on google maps, when I open the ViewController?"?

我正在使用iOS(Swift)的Googlemapsdk。有谁知道如何“在我打开ViewController时在谷歌地图上显示我的当前位置”?实际上它就像谷歌地图应用程序。当您打开Googlemap时,蓝点将显示您当前的位置。您不需要在第一次按“myLocationButton”。所以这是代码:importUIKitimportCoreLocationimportGoogleMapsclassGoogleMapsViewer:UIViewController{@IBOutletweakvarmapView:GMSMapView!letlocationManager=CLLocation

swift - 开关 : Enum Switch issue : Not member of a int

我正在用Swift编写我的第一个项目(我多年来一直在使用ObjectiveC),出于某种原因,我无法弄清楚为什么我的枚举和Switch不能一起工作enumContactViewMode:Int{caseViewModeFavourite=0caseViewModeRecent=1caseViewModeContacts=2}属性@IBInspectablevarcontactViewMode:Int!切换switchcontactViewMode{caseContactViewMode.ViewModeFavourite:contacts=DBManager.getFavouriteC

ios - '设置<NSObject >' does not have a member named ' anyObject。"- Xcode 6.3

我正在检查是否已选择一个元素。functouchesBegan(touches:Set,withEventevent:UIEvent){//First,seeifthegameisinapausedstateif!gamePaused{//Declarethetouchedsymbolanditslocationonthescreenlettouch=touches.anyObject!as?UITouchletlocation=touch.locationInNode(symbolsLayer)这之前在Xcode6.2中编译良好,但在6.3更新后,“lettouch=touches.