草庐IT

date_parse

全部标签

swift - 为什么具有两个 `as Date` 对象的 `timeIntervalSince()` 需要 `NSDate`?

我有一个NSManagedObject对象:@NSManagedpublicvartimestamp:NSDate我需要两者之间的时间间隔,所以我实现了:letinterval=next.timestamp.timeIntervalSince(current.timestamp)为什么会出现以下错误?'NSDate'isnotimplicitlyconvertibleto'Date';didyoumeantouse'as'toexplicitlyconvert?我很惊讶,因为next和current都是NSDate类型,而timeIntervalSince()是NSDate方法。按照错

swift - 如何设置parse ACL为public write?

我正在编写一个应用程序,我想在其中为创建的对象设置ACL以允许公共(public)写入(存在删除对象的问题,这是我想要做的,只有在公共(public)写入时才能完成设置为真)。我看到了几个类似的问题,这些问题得到了如下回答:letacl=PFACL()acl.setPublicReadAccess(true)acl.setPublicWriteAccess(true)yourObject.ACL=acl但是,.setPublicWritAccess(bool)似乎不再是正确的语法。我试着用类似的方式来做:acl.setWriteAccess(true,for:"Public")但这没有

ios - 缓慢的数据返回Parse iOS swift 3

我正在使用Parse版本“1.14.4”iOS10.3.2和swift3。无论是本地(他返回的对象被固定)还是远程,查询都很慢。谢谢letplaceObject=PFObject(className:"PlaceObject")letpoint=PFGeoPoint(latitude:self.PointGlobal.latitude,longitude:self.PointGlobal.longitude)placeObject["location"]=pointletquery=PFQuery(className:"CLocationObject")//Interestedinlo

ios - 如何在 Swift 4 中将 Any 转换为 Date?

我从服务器收到一个日期://ItcomesfromserverasAnylet.letuserInfo:[AnyHashable:Any]letuserInfoDic=userInfoasNSDictionaryuserInfoDic.value(forKey:"gcm.notification.date")asAny//printsOptional(2018-04-26)如果我尝试转换为日期,则会抛出错误:‘Any?’isnotconvertibleto'Date';didyoumeantouse'as!'toforcedowncast?当我强制执行时,返回一个fatalerror。

ios - swift 对象映射器 : How to parse array inside of an array

这是我的JSON响应:[[{"id":22,"request_id":"rqst5c12fc9e856ae1.06631647","business_name":"CodeViable","business_email":"code@viable.com","title":"ApacheLoad/Ubuntu",}],[{"id":24,"request_id":"rqst5c130cae6f7609.41056231","business_name":"CodeViable","business_email":"code@viable.com","title":"Load",}]]这

json - swift 对象映射器 : How to parse JSON with backslash

我已经在stackoverflow上尝试了几乎所有可能的解决方案,但到目前为止没有成功,这是我的json响应:["{\"id\":5,\"request_id\":\"rqst5c17fc752d44f1.15452158\",\"business_name\":\"611Solutions\",\"business_email\":\"611thesolutions@gmail.com\",\"title\":\"123ABC-TESTING\",\"details\":\"Packageisfragile,pleasehaulwithcare\",\"load_descriptio

date - Parse.com — 在 Swift 中使用日期对象查询

我数据库中的一个解析对象有一个日期字段。我想使用用户选择的日期作为查询。query.whereKey("dateFieldParse",equalTo:janFirst)我不确定如何设置这个“janFirst”字段。我知道它必须以某种方式格式化以进行解析检索,但这种格式是什么。我尝试在NSDate对象中设置组件,但它似乎不起作用。letuserCalendar=NSCalendar.currentCalendar()letjanFirstComponent=NSDateComponents()janFirstComponent.year=2014janFirstComponent.mo

xcode - 在后台使用 Parse 的注册时出现 Swift 问题

在后台使用Parse的注册block时,我遇到了Swift的问题funcSignup(){varuser=PFUser()user.username=self.username.textuser.password=self.password.textuser.email="email@example.com"user.signUpInBackgroundWithBlock{(succeeded:Bool!,error:NSError!)->Voidinif(error!=nil){}else{leterrorString=error.userInfo["error"]as?NSStri

ios - PFUser 查询需要时间从 Parse 中获取用户

这是我的viewDidLoad方法-varquery=PFUser.query()query.findObjectsInBackgroundWithBlock({(objects:[AnyObject]!,error:NSError!)->Voidin//self.users.removeAll(keepCapacity:true)forobjectinobjects{varuser:PFUser=objectasPFUserprintln(user.username)self.users.append(user.username)}self.tableView.reloadData(

ios - 编辑/创建自定义字段 - parse.com iOS sdk (swift)

我想使用parseiOSsdk在我的parse应用程序中编辑自定义字段,但是,建议的方法似乎不起作用。varuser=PFUser()//otherfieldscanbesetjustlikewithPFObjectuser["phone"]="415-392-0202"//ERROR:cannotassignavalueoftypestringtoavalueoftypeanyobject?user.setValue和user.setObject方法似乎确实更新了值,但更改在Parse.comwebui中仍然看不到。//facebookIDisastringparsefielduse