如何修复“无法取消链接'文件名':资源繁忙

时间:2019-08-12 13:03:12

标签: git git-reset

当我尝试还原某些本地更改时,它显示“错误:无法取消链接旧的'文件名':资源繁忙”

我已经尝试隐藏更改,使用class YourCustomPageViewController: UIPageViewController { // for example purpose i will use only two view controllers, you can use more var firstVC: CustomViewController? var secondVC: CustomViewController? //MARK: Private Properties fileprivate var pages: [UIViewController] = [] //MARK: Object Life Cycle override func viewDidLoad() { super.viewDidLoad() self.view.backgroundColor = .white dataSource = self delegate = self //This is your static background, which will be added on page view controller and will not be scrollable let bgImageView = UIImageView(image: UIImage(named: "bg")) bgImageView.translatesAutoresizingMaskIntoConstraints = false self.view.insertSubview(bgImageView, at: 0) NSLayoutConstraint.activate([ bgImageView.leftAnchor.constraint(equalTo: self.view.leftAnchor, constant: 0), bgImageView.rightAnchor.constraint(equalTo: self.view.rightAnchor, constant: 0), bgImageView.topAnchor.constraint(equalTo: self.view.topAnchor, constant: 0), bgImageView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor, constant: 0) ]) firstVC = (self.storyboard?.instantiateViewController(withIdentifier: "FirstVCIdentifier")) as? CustomViewController secondVC = (self.storyboard?.instantiateViewController(withIdentifier: "SecondVCIdentifier")) as? CustomViewController pages.append(firstVC!) pages.append(secondVC!) setViewControllers([firstVC!], direction: .forward, animated: true, completion: nil) } //MARK: UIPageViewControllerDataSource & UIPageViewControllerDelegate extension YourCustomPageViewController: UIPageViewControllerDataSource, UIPageViewControllerDelegate { func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? { guard let index = pages.firstIndex(of: viewController) else { return nil } let previousIndex = index - 1 return previousIndex >= 0 ? pages[previousIndex] : nil } func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? { guard let index = pages.firstIndex(of: viewController) else { return nil } let nextIndex = index + 1 return nextIndex < pages.count ? pages[nextIndex] : nil } } ,但没有任何效果。

2 个答案:

答案 0 :(得分:0)

您只需要以管理员权限运行编辑器(例如:VS Code),然后重试,它将起作用,我遇到了同样的问题,并且此解决方案可以解决此问题。

答案 1 :(得分:0)

我通过重新启动计算机解决了这个问题。