我真的不能得到什么问题?
我正在尝试从firebase Settings
节点加载一些设置数据.其他函数中其他节点的相同代码可以工作,但这个代码不明确.为什么?
var ref:FIRDatabaseReference! //Global variable
override func viewDidLoad() {
super.viewDidLoad()
self.mapView.delegate = self
if CLLocationManager.locationServicesEnabled() {
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.requestWhenInUseAuthorization()
locationManager.startUpdatingLocation()
// monitorRegion()
} else {
// Alert to enable location services on iphone first
}
ref = FIRDatabase.database().reference(fromURL: "https://*******.firebaseio.com/")
//The error is here
ref.child("Settings").child("service_types").observe(.value) { (snapshot) in
}
// Do any additional setup after loading the view.
}
Run Code Online (Sandbox Code Playgroud) 我真的不会在stackoverflow上提出问题,除非我真的无法在互联网上找到解决方案.我这里有一个压倒一切的方法问题.这是AWS生成的DynamoDB代码.我使用swift 3.0我试图删除覆盖但没有用我得到这个错误:
/ Users/*****_*****/Desktop/APPS/Beer On The Go/AmazonAws/Models/NoSQL/Bars.swift:57:16:方法'JSONKeyPathsByPropertyKey()'与Objective-C选择器' JSONKeyPathsByPropertyKey'与来自超类'AWSDynamoDBObjectModel'的方法'jsonKeyPathsByPropertyKey()'冲突,具有相同的Objective-C选择器
有什么提示可以解决这个问题吗?
override class func JSONKeyPathsByPropertyKey() -> [NSObject : AnyObject] {
return [
"_userId" as NSObject : "userId" as AnyObject,
"_barId" as NSObject : "barId" as AnyObject,
"_category" as NSObject : "Category" as AnyObject,
"_description" as NSObject : "Description" as AnyObject,
"_name" as NSObject : "Name" as AnyObject,
]
}
Run Code Online (Sandbox Code Playgroud)
我有一套NSAttributedString
,UITextView
我需要检查它的NSAttributedStringKey.foregroundColor
价值。
char = attributedText.attributedSubstring(from: attributedRange)
Run Code Online (Sandbox Code Playgroud)
我尝试使用这个过滤器,但我真的不知道如何使用它。
let attr = char.attributes(at: 0, effectiveRange: nil)
attr.filter({ (<#(key: NSAttributedStringKey, value: Any)#>) -> Bool in
//if true...
})
Run Code Online (Sandbox Code Playgroud)