草庐IT

community_event_users

全部标签

ios - UIWindow 子类 : Touches event not get fired

我想在当前项目中实现session时间功能。因此,为此我尝试子类化UIWindow并覆盖touchesBegan和touchesEnded方法。classBaseWindow:UIWindow{convenienceinit(){self.init(frame:UIScreen.mainScreen().bounds)}privatevarsessionTimeOutTimer:NSTimer?overridefunctouchesBegan(touches:Set,withEventevent:UIEvent?){sessionTimeOutTimer?.invalidate()}o

ios - 如何从 URL 中拆分出现 "users/"的字符串?

我正在使用这种方法,这是我的URL“https://www.youtube.com/user/myYoutubeChennal”。我想从中获取“myYoutubeChennal”。funcsplitVideoUrl(videoUrl:String)->String{//lettoken=videoUrl.split(separator:"user/")letttstr:String="https://www.youtube.com/user/myYoutubeChennal"ifletrange=ttstr.range(of:"user/"){letfirstPart=String(d

ios - 保存 CKDatabaseSubscription 得到 “CloudKit access was denied by user settings”

我正在尝试设置CloudKitCKDatabaseSubscription并尝试保存它,但出现以下错误:'“未认证”(9/1002);“CloudKit访问被用户设置拒绝”;3.0秒后重试我可以通过该应用在私有(private)数据库上创建记录,没有任何问题,但订阅不会保存。container=CKContainer(identifier:"")publicDB=container.publicCloudDatabaseprivateDB=container.privateCloudDatabasecreateSubscriptions()funccreateSubscriptions

swift - swift 中 "event listeners"的想法如何分为 Action 和协议(protocol)?

我的问题作为一名正在学习Swift的新程序员。我想知道为什么在事件监听器的实现方式之间似乎存在任意划分。在一些教程中,指出您可以简单地在Storyboard上的View元素和ViewController之间拖动以创建Action(事件监听器)。@IBActionfuncclickButtonListener(_sender:UIButton){print("helloworld")}但在后面的教程中,我注意到某些类似事件监听器的功能也以协议(protocol)的形式实现classViewController:UIViewController,UIScrollViewDelegate{f

ios - TouchID 错误代码 : -1004 NSLocalizedDescription: User interaction is required

我正在开发使用触摸ID登录的应用程序。它应该只在第一次启动时要求触摸ID(即,当应用程序从后台进入前台时,我不要求触摸ID身份验证)。这是我为显示touchID所做的操作:AppDelegate.swift:funcapplication(application:UIApplication,didFinishLaunchingWithOptionslaunchOptions:[NSObject:AnyObject]?)->Bool{letloginViewController=storyboard.instantiateViewControllerWithIdentifier("log

ios - 解析 : User and error both nil with logInInBackgroundWithReadPermissions()

我正在使用Xcode7.1、Swift2、Parse1.9.1和FacebookSDK4.7.1。我一直在iOS8上使用PFFacebookUtils.logInInBackgroundWithReadPermissions非常好,但是一旦我更新到iOS9我就无法使用它。每次我使用这个登录时:letpermissions=["email"]PFFacebookUtils.logInInBackgroundWithReadPermissions(permissions){(user:PFUser?,error:NSError?)->Voidinprint(user)print(error

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

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

ios - 带有 qos_class_user_interactive 的 global_queue

我试图理解GCD并编写了这段代码来找出运行优先级:overridefuncviewDidLoad(){super.viewDidLoad()fetchImage()print(1)dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED,0)){print(2)}dispatch_async(dispatch_get_main_queue()){print(3)}dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE,0)){prin

ios - CoreLocation 线程崩溃崩溃 : com. apple.CoreLocation.ConnectionClient.0x16fcb870.events

我在我们的生产应用程序中遇到了Apple的CoreLocation线程崩溃。我无法在我的测试中重现它,也很难弄清楚它是在CoreLocation内部。目前它只发生在少数人口中,但我可以看到它正在变得越来越大。Crashed:com.apple.CoreLocation.ConnectionClient.0x16fcb870.events0CoreLocation0x2aa2db54CLClientCreateIso6709Notation+536751CoreLocation0x2aa2dc7bCLClientCreateIso6709Notation+539702CoreLocati

ios - event.touchesForView().AnyObject() 在 Xcode 6.3 中不起作用

这在之前非常有效:funcdoSomethingOnDrag(sender:UIButton,event:UIEvent){lettouch=event.touchesForView(sender).AnyObject()asUITouchletlocation=touch.locationInView(sender)}但是在Xcode6.3中,我现在得到错误:Cannotinvoke'AnyObject'withnoarguments我该如何解决这个问题? 最佳答案 在1.2中,touchesForView现在返回原生SwiftS