ライブラリOnboard、スキップで画面遷移時 クラッシュ
Onboardライブラリのスキップハンドラーで画面遷移しようとするとエラーがでます。
クリーンとビルドも何度か試しました。原因が分かりません。
Swift3.0
Onboard v2.3.1
Xcode 8.1
エラーメッセージ
skip 2016-12-07 08:09:10.700 OnboardTestEX[2975:60144] * Terminating
app due to uncaught exception 'NSInvalidArgumentException', reason:
'Receiver () has no
segue with identifier 'SegueIdentifier''
* First throw call stack: ( 0 CoreFoundation 0x000000010a7bf34b exceptionPreprocess + 171 1 libobjc.A.dylib
0x0000000107d1a21e objc_exception_throw + 48 2 UIKit
0x000000010838db6b -[UIViewController
shouldPerformSegueWithIdentifier:sender:] + 0 3 OnboardTestEX
0x0000000107712c72
_TFFC13OnboardTestEX14ViewControllercFT5coderCSo7NSCoder_GSqS0__U3_FT_T_
+ 450 4 OnboardTestEX 0x0000000107712761 _TTRXFo___XFo_iT__iT + 17 5 OnboardTestEX 0x0000000107712dd1 _TPA__TTRXFo___XFo_iT__iT__.19 + 81 6
OnboardTestEX 0x0000000107712e00
_TTRXFo_iT__iT__XFo___ + 32 7 OnboardTestEX 0x0000000107712eb7 _TTRXFo___XFdCb___ + 39 8 Onboard
0x00000001077bf0c8 -[OnboardingViewController handleSkipButtonPressed]
+ 120 9 UIKit 0x00000001081eb5b8 -[UIApplication sendAction:to:from:forEvent:] + 83 10 UIKit 0x0000000108370edd -[UIControl sendAction:to:forEvent:] + 67 11
UIKit 0x00000001083711f6 -[UIControl
_sendActionsForEvents:withEvent:] + 444 12 UIKit 0x00000001083700f2 -[UIControl touchesEnded:withEvent:] + 668 13
UIKit 0x0000000108258ce1 -[UIWindow
_sendTouchesForEvent:] + 2747 14 UIKit 0x000000010825a3cf -[UIWindow sendEvent:] + 4011 15 UIKit
0x000000010820763f -[UIApplication sendEvent:] + 371 16 UIKit
0x00000001089f971d dispatchPreprocessedEventFromEventQueue + 3248
17 UIKit 0x00000001089f23c7
__handleEventQueue + 4879 18 CoreFoundation 0x000000010a764311
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 19 CoreFoundation 0x000000010a74959c
__CFRunLoopDoSources0 + 556 20 CoreFoundation 0x000000010a748a86 __CFRunLoopRun + 918 21 CoreFoundation
0x000000010a748494 CFRunLoopRunSpecific + 420 22 GraphicsServices
0x000000010e695a6f GSEventRunModal + 161 23 UIKit
0x00000001081e9964 UIApplicationMain + 159 24 OnboardTestEX
0x000000010771521f main + 111 25 libdyld.dylib
0x000000010c43f68d start + 1 ) libc++abi.dylib: terminating with
uncaught exception of type NSException
以下ソースです。skipHandlerの中にperformSegueがあります。
import UIKit
import Onboard
class ViewController: OnboardingViewController {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
required init?(coder aDecoder: NSCoder) {
let welcomePage = OnboardingContentViewController(title: "PAY WHAT YOU WANT", body: "I made my app so you could have the best experience reading tech related news. That’s why I want you to value it based on your satisfaction.", image: UIImage(named: "Purchase-Pig"), buttonText: "") {}
let firstPurchasePage = OnboardingContentViewController(title: "MINT", body: "The app is great but there’s still a few places in room of improvement. If this is your feeling this is for you.", image: UIImage(named: "Purchase-Mint"), buttonText: "69p") {}
let secondPurchasePage = OnboardingContentViewController(title: "SWEET", body: "IThis is the suggested price where you value the time I spent on development and design. Feel free to pay more or less.", image: UIImage(named: "Purchase-Lolly"), buttonText: "£1.49") {}
let thirdPurchasePage = OnboardingContentViewController(title: "GOLD", body: "Hello is it me your looking for, if this popped into your mind using the app then this is the price for you.", image: UIImage(named: "Purchase-Gold"), buttonText: "£2.99") {}
super.init(backgroundImage: nil, contents: [welcomePage, firstPurchasePage, secondPurchasePage, thirdPurchasePage])
// Customize Onboard viewController
allowSkipping = true
skipHandler = { _ in
print("skip")
self.performSegue(withIdentifier:"SegueIdentifier", sender: nil)
}
}
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = UIColor.yellow
}
}
ーーーーーー
以下のようにして、ストーリーボードのセグエは使わないようにしたら遷移出来ました。
let storyboard: UIStoryboard = self.storyboard!
let nextView = storyboard.instantiateViewController(withIdentifier: "next") as! NextViewController
self.present(nextView, animated: true, completion: nil)