面对:
class CategoryCell: UICollectionViewCell, UICollectionViewDelegateFlowLayout {
override init(frame: CGRect) {
super.init(frame: frame)
setupViews()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
let appView:UICollectionView = {
let layout = UICollectionViewFlowLayout()
let view = UICollectionView(frame: .zero, collectionViewLayout: layout)
view.translatesAutoresizingMaskIntoConstraints = false
view.backgroundColor = UIColor.blue
return view
}()
func setupViews() {
contentView.addSubview(appView)
let layoutGuide = contentView.layoutMarginsGuide
appView.leadingAnchor.constraint(equalTo: layoutGuide.leadingAnchor, constant: 8).isActive = true
appView.trailingAnchor.constraint(equalTo: layoutGuide.trailingAnchor, constant: 8).isActive = true
appView.topAnchor.constraint(equalTo: layoutGuide.topAnchor).isActive = true
appView.bottomAnchor.constraint(equalTo: layoutGuide.bottomAnchor).isActive = true
// addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-8-[v0]-8-|", options: NSLayoutFormatOptions(), metrics: nil, views: ["v0": appView]))
// addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|[v0]|", options: NSLayoutFormatOptions(), metrics: nil, views: ["v0": appView]))
}
}
我正在运行一个查询来获取所有文档,完成了一些操作。
有关如何解决这个问题的任何帮助?
修改的 代码:
GatewayProxy.java:performPostRequest:273:IllegalStateException: Http client execution failed
查询:
@Override
public List<EmployeeRecord> fetchAllEmployeeRecords() {
List<EmployeeRecord> employeeRecords = getAllDocuments();
if(employeeRecords.size() > 0){
return employeeRecords;
}
return null;
}
private List<EmployeeRecord> getAllDocuments(){
String query = String.format(QUERY_FETCH_ALL_RECORD);
List<Document> documents = documentClient.queryDocuments(getCollectionLink(), query, null).getQueryIterable().toList();
List<EmployeeRecord> documentList = new GsonBuilder().create().fromJson(documents.toString(),employeeRecord);
return documentList;
}