2016-12-03 5 views
1

ないたびに私はは、プログラムNavigationControllerでクラッシュネストされたのViewControllerに提示されたのViewControllerを閉じますが、私はNavigationControllerにネストされているのViewControllerでプログラム発表されたのViewControllerを解任しようとすると

のlibcを得るように見えます++ abi.dylib:NSException型のキャッチされていない例外で終了する

これ以上の情報は一切ありません。モーダルネストされた1上に提示される

マイのViewController:

class RefreshController: UIViewController { 

@IBOutlet var label: UILabel! 
@IBOutlet var main: UIView! 
@IBOutlet var spinner: UIActivityIndicatorView! 



override func viewDidLoad() { 
    super.viewDidLoad() 

    spinner.startAnimating() 
    label.text = .localized("refreshing") + " ..." 

    main.layer.cornerRadius = 5 
} 

public func hideRefresh(_ contr: UIViewController, completion: @escaping (() -> Swift.Void)){ 
    contr.presentedViewController?.dismiss(animated: true, completion: { 
     refreshController = nil 
     completion() 
    }) 
} 

class func showRefresh(_ contr: UIViewController!, completion: @escaping (() -> Swift.Void)){ 
    refreshController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "refreshController") as! RefreshController 

    contr.present(refreshController, animated: true, completion: { 
     completion() 
    }) 
} 
} 

私は、たびにそれにアクセスするように示されているときに現在提示コントローラとしての地位を定義するグローバル変数refreshControllerを有します。私は呼んでネストされたのViewControllerで

refreshController.hideRefresh(self, completion: { 
//code goes here, after the controller dismissed 
} 

(完成部分が原因ときどき提示しなければならないUIAlertsと競合するアニメーションにある)

は、誰もがこれでの経験を持っていますか?それとも、最新のiOS 10.2(14C82)ベータ版のバグですか?提示のViewControllerではなく、提示された1つの

答えて

0

コールdismiss

public func hideRefresh(_ contr: UIViewController, completion: @escaping (() -> Swift.Void)){ 
    // instead of contr.presentedViewController?.dismiss... 
    contr.dismiss(animated: true, completion: { 
     refreshController = nil 
     completion() 
    }) 
} 
+0

私はSTILエラーが出るん:/ – Fabbou

+0

より多くの情報を取得するには、例外ブレークポイントを設定します。 – shallowThought

+0

私はそれが働いた、私はそれが呼び出しの順序のためだと思う – Fabbou

関連する問題