2015-08-15 81 views
2

我有一個UIPageViewController與三個嵌入UINavigationController s。該應用在我的設備上完美運行,但在其他一些測試設備上,我收到Crashlytics的崩潰:function signature specialization <Arg[0] = Owned To Guaranteed>功能簽名專業化<Arg [0] =擁有保證>

這是我在Crashlytics收到的報告。

enter image description here

這是我使用的設置我的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行中,它指向PageViewController。似乎沒有關於這個錯誤的很多信息,但從我讀過的內容來看,它似乎與某個地方的零值有關。任何人都可以就此提供建議嗎?

和線路47上PageViewController點self.storyboard!.instantiateViewControllerWithIdentifier("ProfileNav") as! UINavigationController

+0

您是否嘗試過不打開這些選項? 'self.storyboard?.instantiateViewControllerWithIdentifier(「ProfileNav」)爲? UINavigationController' –

回答

0

原來,一些測試用戶試圖打開他們的Gmail應用,這顯然你不應該做TestFlight邀請。我告訴他們從Safari或Apple Mail打開,它工作。感謝額外的頭痛TestFlight。

+0

這是一個Gmail問題,並不是TestFlight所特有的。 Gmail會將用戶輸入到他們的網絡瀏覽器中,類似於Facebook。責備谷歌。 – thefaj