# TableView rotation issue, crashes

**URL:** <https://forums.kodeco.com/t/tableview-rotation-issue-crashes/88898>\
**Category:** iOS Apprentice\
**Created:** [November 22, 2019, 2:56am UTC](https://forums.kodeco.com/t/tableview-rotation-issue-crashes/88898 "2019-11-22T02:56:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![zoran](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/zoran/32/102075_2.png) [@zoran](https://forums.kodeco.com/u/zoran)\
**Post date:** [November 22, 2019, 2:56am UTC](https://forums.kodeco.com/t/tableview-rotation-issue-crashes/88898/1 "2019-11-22T02:56:59Z")

</div>

Reposted - had it in wrong book category.

I’m currently doing the StoreSearch tutorial and as of lat it keeps crashing due to following error…

**2019-11-19 18:11:32.056113+1000 StoreSearch[3317:436206] [Window] Manually adding the rootViewController’s view to the view hierarchy is no longer supported. Please allow UIWindow to add the rootViewController’s view to the view hierarchy itself.**  
**URL: '[https://itunes.apple.com/search?term=Doctrine’](https://itunes.apple.com/search?term=Doctrine%E2%80%99)**  
**Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value: file /Users/iMac2013/OneDrive/\_CODING\_Drives/Tutorials/iOS\_Apprentice/StoreSearch/StoreSearch/SearchViewController.swift, line 67**

line 67 (in SearchViewController.swift) is,  
// reloads the tableview data  
tableView.reloadData()

note - I am using devices (iPhone or iPad, whichever I get my hands on first) rather than the simulator. but the error and crash is exactly the same on both… even if I only checkmark the device I test on.

I don’t think it is a tutorial issue but an Xcode issue as there seems to be similar occurrence when I do a search for it… but can’t work out a fix.

to keep the tutorial going I have found that if I set it to portrait only (in the Xcode app setting) it won’t crash… but strangely you can rotate the tablet/phone and it will rotate and run in landscape even though landscape is unchecked… and it won’t crash/ check the landscape box for an and it crashes in landscape.

is this something that can be addressed within the tutorial code or is this just an apple bug that will keep going till fixed.

---

<div class="post-metadata">

**Author:** ![lganti](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/lganti/32/103565_2.png) [@lganti](https://forums.kodeco.com/u/lganti)\
**Post date:** [November 22, 2019, 7:08am UTC](https://forums.kodeco.com/t/tableview-rotation-issue-crashes/88898/2 "2019-11-22T07:08:10Z")

</div>

set `rootViewController` of `window` in `AppDelegate`

one of the ways to resolve these sort of errors yourself is straight up copy paste the error in the google search bar

---

<div class="post-metadata">

**Author:** ![haitang](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/haitang/32/86868_2.png) [@haitang](https://forums.kodeco.com/u/haitang)\
**Post date:** [December 20, 2019, 2:28am UTC](https://forums.kodeco.com/t/tableview-rotation-issue-crashes/88898/3 "2019-12-20T02:28:34Z")

</div>

check the outlets in the search view controller. Probably you mis-connected the view controller to “view”

---

<div class="post-metadata">

**Author:** ![zoran](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/zoran/32/102075_2.png) [@zoran](https://forums.kodeco.com/u/zoran)\
**Post date:** [December 21, 2019, 5:45am UTC](https://forums.kodeco.com/t/tableview-rotation-issue-crashes/88898/4 "2019-12-21T05:45:12Z")

</div>

Thanks for response… everything hooked up right. I think it is an Xcode thing as my fix is clean the build then do a fresh build… works every time, however if I build without a clean then second, third or fourth build to device will crash. This is the only app/tutorial it happens on so not too fussed. Thanks all.

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [January 11, 2020, 9:33pm UTC](https://forums.kodeco.com/t/tableview-rotation-issue-crashes/88898/5 "2020-01-11T21:33:11Z")

</div>

@zoran Do you still have issues with this?

---

<div class="post-metadata">

**Author:** ![zoran](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/zoran/32/102075_2.png) [@zoran](https://forums.kodeco.com/u/zoran)\
**Post date:** [January 21, 2020, 8:36am UTC](https://forums.kodeco.com/t/tableview-rotation-issue-crashes/88898/6 "2020-01-21T08:36:31Z")

</div>

all good. just have to treat as Xcode glitch.I do a “clean the folder” on it and works fine. reverts to crashing on next “run to device” unless I clean folder beforehand. not fussed.

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [May 6, 2020, 7:07pm UTC](https://forums.kodeco.com/t/tableview-rotation-issue-crashes/88898/7 "2020-05-06T19:07:11Z")

</div>

Closed on May 6, 2020, 7:07pm UTC

This topic was automatically closed after 166 days. New replies are no longer allowed.
