мы использовали контроллер просмотра страниц, чтобы показать свайп, чтобы дать пользователю команду войти в систему, мы столкнулись с базовым фундаментом cra sh, ниже приведен фрагмент стека и фрагмент кода:
StackTrace:
Fatal Exception: NSInvalidArgumentException
The number of view controllers provided (0) doesn't match the number required (1) for the requested transition
keyboard_arrow_up
Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x2362a8518 __exceptionPreprocess
1 libobjc.A.dylib 0x2354839f8 objc_exception_throw
2 CoreFoundation 0x2361b2c70 -[NSCache init]
3 UIKitCore 0x2620c1e94 -[UIPageViewController _validatedViewControllersForTransitionWithViewControllers:animated:]
4 UIKitCore 0x2620c2a2c -[UIPageViewController _setViewControllers:withCurlOfType:fromLocation:direction:animated:notifyDelegate:completion:]
extension HelpPageViewController: UIPageViewControllerDataSource {
func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? {
guard let viewControllers = pageViewControllers, let index = viewControllers.index(of: viewController), index > 0 else { return nil }
return viewControllers[index - 1]
}
func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? {
guard let viewControllers = pageViewControllers, let index = viewControllers.index(of: viewController), index < viewControllers.count - 1 else { return nil }
return viewControllers[index + 1]
}
}
override func viewDidLoad() {
super.viewDidLoad()
dataSource = self
pageViewControllers = helpType?.viewControllers
if let helpViewControllers = pageViewControllers {
DispatchQueue.main.async{
if let firstViewController = helpViewControllers.first {
self.setViewControllers([firstViewController], direction: .forward, animated: false, completion: nil)
}
}
}
}
var helpType:HelpType?
var pageViewControllers:[UIViewController]?
}