我有一个UIPageViewController
带有三个嵌入式UINavigationController
s的。该应用程序可以在我的设备上完美运行,但是在其他一些测试设备上,我却崩溃了:function signature specialization <Arg[0] = Owned To Guaranteed>
在Crashlytics中。
这是我在Crashlytics中获得的报告。
这是我用来设置我的代码的代码UIPageViewController
。
import Foundation
import UIKit
import Parse
class PageViewController: UIPageViewController, UIPageViewControllerDataSource, UIPageViewControllerDelegate {
private var pages: [UINavigationController]!
private var currentPageIndex: Int!
override func viewDidAppear(animated: Bool) {
if (FBSDKAccessToken.currentAccessToken() != nil) {
} else {
self.performSegueWithIdentifier("toSignup", sender: self)
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Page view controller is initial VC, but if FB Access Token is nil, redirect to signup flow
if (FBSDKAccessToken.currentAccessToken() != nil) {
self.dataSource = self
self.delegate = self
self.pages = [
self.storyboard!.instantiateViewControllerWithIdentifier("DiscoverNav") as! UINavigationController,
self.storyboard!.instantiateViewControllerWithIdentifier("LiveFeedNav") as! UINavigationController,
self.storyboard!.instantiateViewControllerWithIdentifier("ProfileNav") as! UINavigationController
]
(self.pages[0].topViewController as! DiscoverViewController).parentPageViewController = self
(self.pages[1].topViewController as! LiveFeedViewController).parentPageViewController = self
(self.pages[2].topViewController as! ProfileViewController).parentPageViewController = self
self.currentPageIndex = 1
let startingViewController = self.pages[1] as UINavigationController
self.setViewControllers([startingViewController], direction: .Forward, animated: false, completion: nil)
} else {
self.performSegueWithIdentifier("toSignup", sender: self)
}
}
func pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) -> UIViewController? {
let index = (self.pages as NSArray).indexOfObject(viewController)
self.currentPageIndex = index
// if currently displaying last view controller, return nil to indicate that there is no next view controller
return (self.currentPageIndex == self.pages.count - 1 ? nil : self.pages[self.currentPageIndex + 1])
}
func pageViewController(pageViewController: UIPageViewController, viewControllerBeforeViewController viewController: UIViewController) -> UIViewController? {
let index = (self.pages as NSArray).indexOfObject(viewController)
self.currentPageIndex = index
// if currently displaying first view controller, return nil to indicate that there is no previous view controller
return (index == 0 ? nil : self.pages[index - 1])
}
func displayPageForIndex(index: Int, animated: Bool = true) {
assert(index >= 0 && index < self.pages.count, "Error: Attempting to display a page for an out of bounds index")
// nop if index == self.currentPageIndex
if self.currentPageIndex == index { return }
if index < self.currentPageIndex {
self.setViewControllers([self.pages[index]], direction: .Reverse, animated: true, completion: nil)
} else if index > self.currentPageIndex {
self.setViewControllers([self.pages[index]], direction: .Forward, animated: true, completion: nil)
}
self.currentPageIndex = index
}
}
现在看来,当机问题来自ProfileViewController.swift
,但是UIPageView
载入时却从未从该页面调用任何内容。在Crashlytics报告的第16和17行上,它指向PageViewController。关于此错误的信息似乎并不多,但是从我阅读的内容来看,这似乎与某处的nil值有关。有人可以提供建议吗?
并且PageViewController上的第47行指向 self.storyboard!.instantiateViewControllerWithIdentifier("ProfileNav") as! UINavigationController
原来,有些测试用户试图从其Gmail应用程序中打开TestFlight邀请,显然您不应该这样做。我告诉他们可以从Safari或Apple Mail打开,并且可以正常工作。感谢您额外的头痛TestFlight。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句