AppDelegateでは、ユーザセッションリストがユーザホーム(2つのボタンを表示)に移動するかどうかを確認し、ログインページに移動します。ユーザーホームにログインした後にフォームのログインページを作成します。Swift:UIViewControllerをUITableViewControllerにナビゲート中の例外
LoginViewがUIViewController
USERHOMEがUIViewController
私はUSERHOMEの "ゲットレポート" をクリックすると、私は ReportViewがここUITableViewController
あるテーブル内のいくつかのレポートを表示するアプリケーション・コードは
であるですAppDelegate
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let mainStoryboard:UIStoryboard = UIStoryboard (name: "Main", bundle: nil)
let isUserLoggedIn:Bool = NSUserDefaults.standardUserDefaults().boolForKey("isUserLoggedIn")
if(!isUserLoggedIn){
let loginVC = mainStoryboard.instantiateViewControllerWithIdentifier("loginvc") as! LoginVC
window!.rootViewController = loginVC
window!.makeKeyAndVisible();
}else{
let userhome = mainStoryboard.instantiateViewControllerWithIdentifier("userhome") as! UserHomeViewController
window!.rootViewController = userhome
window!.makeKeyAndVisible();
}
return true
}
LoginView
残りのサービスからの大成功応答ゲットレポートに
let userhome = self.storyboard?.instantiateViewControllerWithIdentifier("user home") as! UserHomeViewController
dispatch_async(dispatch_get_main_queue()) {
self.presentViewController(userhome, animated: true, completion: nil)
}
後、私は
@IBAction func getReport(sender: UIButton) {
let reportview = self.storyboard?.instantiateViewControllerWithIdentifier("reportvc") as! ReportViewController
//Excepetion
self.presentViewController(reportview, animated: true, completion: nil)
//nothing happens
//self.navigationController?.presentViewController(reportview, animated: true, completion: nil)
}
ReportViewCOntrollerだけに注目しているされています。 26:19.415 AkunaConnect [13163:943688] *がキャッチされない例外によるアプリ 'NSInvalidArgumentException'、理由を終了ベース方法は
class FSMSOListTableViewController: UITableViewController {
var soList = [String]()
override func viewDidLoad() {
super.viewDidLoad()
soList = ["E7677","E7678","E7679","E7680"]
self.tableView.registerClass(UITableView.self, forCellReuseIdentifier: "cell")
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return soList.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(
"cell",
forIndexPath: indexPath) //make the cell
cell.textLabel?.text = self.soList[indexPath.row]
return cell
}
例外
2016年4月9日12である実施しました: '種類のUITableViewCellを渡す必要があります' *ファーストスローコールスタック: ( 0 CoreFoundation 0x0000000102cf9e65 exceptionPreprocess + 165 1 libobjc.A。dylib 0x0000000104a39deb objc_exception_throw + 48 2 CoreFoundationの0x0000000102cf9d9d + [NSExceptionレイズ:フォーマット:] + 205 3のUIKit 0x0000000103662b01 - [のUITableView registerClass:forCellReuseIdentifier:] + 285 4 AkunaConnect 0x0000000102ad783f _TFC12AkunaConnect28FSMSOListTableViewController11viewDidLoadfS0_FT_T_ + 623 5 AkunaConnect 0x0000000102ad78f2 _TToFC12AkunaConnect28FSMSOListTableViewController11viewDidLoadfS0_FT_T_ + 34 6のUIKit 0x00000001036acf98 - [のUIViewController loadViewIfRequired] + 1198 7のUIKit 0x00000001036ad2e7 - [ビューのUIViewController] + 27 8のUIKit 0x0000000103e57f87 - [_ UIFullscreenPresentationController _setPresentedViewController:] + 87 9のUIKit 0x0000000103 67cf62 - [UIPresentationController initWithPresentedViewController:presentingViewController:] + 133 10のUIKit 0x00000001036bfc8c - [のUIViewController _presentViewController:withAnimationController:終了:] + 4002 11のUIKit 0x00000001036c2f2c - [のUIViewController _performCoordinatedPresentOrDismiss:アニメーション:] + 489 12のUIKit 0x00000001036c2a3b - [のUIViewController presentViewController。アニメーション:終了:] + 179 13 AkunaConnect 0x0000000102ad688d _TFC12AkunaConnect17FLMViewController9getReportfS0_FCSo8UIButtonT_ + 621 14 AkunaConnect 0x0000000102ad69ea _TToFC12AkunaConnect17FLMViewController9getReportfS0_FCSo8UIButtonT_ + 58 15のUIKit 0x0000000103518194 - [のUIApplication sendAction:に:から:forEvent:] + 92 16のUIKit 0x0000000 1036876fc - [するuicontrol sendAction:全forEvent:] + 67 17のUIKit 0x00000001036879c8 - [するuicontrol _sendActionsForEvents:withEvent:] + 311 18のUIKit 0x0000000103686af8 - [するuicontrol touchesEnded:withEvent:] + 601 19のUIKit 0x000000010358749b - [UIWindow _sendTouchesForEvent。 ] + 835 20のUIKit 0x00000001035881d0 - [UIWindowのSendEvent:] + 865 21のUIKit 0x0000000103536b66 - [のUIApplicationのSendEvent:] + 263 22のUIKit 0x0000000103510d97 _UIApplicationHandleEventQueue + 6844 23 CoreFoundationの0x0000000102c25a31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 24 CoreFoundationの0x0000000102c1b95c __CFRunLoopDoSources0 + 556 25℃ oreFoundation 0x0000000102c1ae13 __CFRunLoopRun + 867 26 CoreFoundationの0x0000000102c1a828 CFRunLoopRunSpecific + 488 27 GraphicsServices 0x000000010730fad2 GSEventRunModal + 161 28のUIKit 0x0000000103516610 UIApplicationMain + 171 29 AkunaConnect 109 30 +メインlibdyld.dylib 1 31 +開始0x000000010554292d 0x0000000102ad96cd? 0x0000000000000001は0x0 + 1 ) のlibC++ abi.dylib:タイプNSException (lldb)
私はUITableViewCellStyleDefaultのためのコンパイル・エラーが発生しますが、 'self.tableView.registerClass(UITableViewCell.self、forCellReuseIdentifier: "セル")以下のために働いていた私は、私を編集した' – user2672763
回答.. –