草庐IT

login_context

全部标签

ios - 初始化 CBCentralManager : Type of expression is ambiguous without more context

尝试在Swift4.2项目中初始化CBCentralManager。获取评论中显示的错误:importCoreBluetoothclassSomeClass:NSObject,CBCentralManagerDelegate{//Typeofexpressionisambiguouswithoutmorecontextletmanager:CBCentralManager=CBCentralManager(delegate:self,queue:nil)//MARK:-Functions:CBCentralManagerDelegatefunccentralManagerDidUpda

ios - 不清楚的 "Type of expression is ambiguous without more context"错误

几个月后我回到我的旧XCode项目,现在我有很多以前没有的错误,我假设这与更新的语法有关。为什么我会看到:Typeofexpressionisambiguouswithoutmorecontext对于这个block@IBActionfuncsubmitUrl(sender:UIButton){varapp=UIApplication.sharedApplication().delegateas!AppDelegate//ErroroccursinbelowdeclarationofstudentDictvarstudentDict=["latitude":self.latitude,"

swift - "Type of expression is ambiguous without more context"多维数组错误

我正在尝试创建一个数组,该数组最好以这种格式存储对象[[[String,CGPoint,Bool]]],但是到处都是错误,所以我决定将其设置为[[[AnyObject]]]。这是我声明数组的代码:varsavePlayerState:[[[AnyObject]]]=[]如您所见,它是一个多维数组,我需要在其中存储3个内容:当前时间、玩家位置和一个简单的Bool。以下是我尝试将数据保存到数组的方式:savePlayerState.append([timeLabel.text,player.position,isPlayerAlive])我的错误是:Typeofexpressionisam

ios - 如何解决 "Type of expression in ambiguous without more context"?

letattributedString=NSAttributedString(data:encodedData,options:attributedOptions,documentAttributes:nil,error:nil)!编译器错误:“表达式类型不明确,没有更多上下文”怎么解决的? 最佳答案 要求[String:AnyObject]attributedOptions参数要求的格式do{letencodedData=yourEncodedString.dataUsingEncoding(NSUTF8StringEncodin

swift - "Type of expression is ambiguous without more context"尝试创建新变量以附加数组时

我是编码和Swift的新手,现在正在尝试创建一个小型应用程序。我创建了这部分代码:overridefunctableView(tableView:UITableView,didSelectRowAtIndexPathindexPath:NSIndexPath){tableView.deselectRowAtIndexPath(indexPath,animated:true)letcell=tableView.cellForRowAtIndexPath(indexPath)varselectedSubject=toBeAddedSubjects[indexPath.row]asSubje

php - swift 错误 : Error Domain=NSCocoaErrorDomain Code=3840 "Problems with my Login Controller "

这是我的代码,我无法编译它。我正在尝试登录到我的服务器,但它不允许我这样做抱歉,我是编程新手,我研究过stackoverflow,关于这个错误,我只能解析字典或数组。但我通过复制我的JSON响应进行了搜索,但它不起作用。任何建议都会有帮助!!importUIKitclassLogin:UIViewController{@IBOutletvarUsername:UITextField!@IBOutletvarPassword:UITextField!@IBActionfuncLogin(sender:UIButton){letusername=Username.textletpasswo

swift - 在后台线程中将数据同步到服务器 : multiple-contexts in core data

我有两个NSManagedObjectContext:parentContext是主上下文,childContext是PrivateQueueConcurrencyType。使用childContext,我在后台线程中将数据同步到服务器,在同步成功后,我设置了data.isSynced=true。用户可能会在同步期间更改数据。这将通过设置data.isSynced=false将数据标记为脏数据。两个线程(主线程和同步线程)同时运行,如果parentContext有data.isSynced==false并且childContext有data.isSynced==true,这里可能会发生

ios - Swift 3 Firebase : current user login success, 事件已在 Firebase 控制台中删除此用户

在登录表单中通过代码成功创建Firebase用户后。我在Firebase控制台中删除了这个新用户,退出了应用程序。再次打开应用程序时,它仍然提示登录成功,用户已被管理员删除。这是为什么,如何在登录表单中知道用户已删除?引用我下面的登录表单代码:overridefuncviewDidLoad(){super.viewDidLoad()//getthecurrentuserisbysettingalistenerontheAuthobject:FIRAuth.auth()!.addStateDidChangeListener(){auth,userinifuser!=nil{//Useri

ios - Alamofire 4.0.0 : [String:String] is not convertible to [String : Any] & Request is ambiguous without more context

我正在将Alamofire更新到4.0.0Beta1并将XCode8更新到Beta6。首先,我得到了[String:String]isnotconvertibleto[String:Any]错误代码letparameter=["scope":"\(scope)","client":"\(clientId)"]Alamofire.request(link,withMethod:.POST,parameters:parameter,encoding:.json).responseJSON在我更改后将[String:Any]添加到参数中,错误消失但产生了新错误:Expressiontype'

ios - 将文件转换为 Swift 3 : unable to infer closure type in the current context

我正在转换我的应用程序中的一些库代码,但我不知道如何将该文件从Swift2.3转换为Swift3importUIKitstructConstraint{varidentifier:String?varattribute:NSLayoutAttribute=.centerXvarsecondAttribute:NSLayoutAttribute=.notAnAttributevarconstant:CGFloat=0varmultiplier:CGFloat=1varrelation:NSLayoutRelation=.equal}funcattributes(attrs:NSLayou