Q:

Selecting table cell to show new view crashes on iOS7 with "unrecognized selector sent to instance"

I am new to iOS development and I wrote an RSS-feed reader in Swift. The feed items are displayed in a UITableView. When I select (touch, click) an item, a new UIView is displayed, showing the feed description of the selected item.
It works on iOS8 but when I try on iOS7, the application crashes and I get the following output:
2015-03-06 21:18:50.009 FeedReaderApp[9084:607] -[FeedReaderApp.TableViewController showViewController:sender:]: unrecognized selector sent to instance 0x7be8b100
2015-03-06 21:18:50.012 FeedReaderApp[9084:607] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FeedReaderApp.TableViewController showViewController:sender:]: unrecognized selector sent to instance 0x7be8b100'
*** First throw call stack:
(
    0   CoreFoundation                      0x006a61e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x01c4d8e5 objc_exception_throw + 44
    2   CoreFoundation                      0x00743243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
    3   CoreFoundation                      0x0069650b ___forwarding___ + 1019
    4   CoreFoundation                      0x006960ee _CF_forwarding_prep_0 + 14
    5   FeedReaderApp                        0x000b8068 _TFC12FeedReaderApp19TableViewController9tableViewfS0_FTCSo11UITableView23didSelectRowAtIndexPathCSo11NSIndexPath_T_ + 1400
    6   FeedReaderApp                        0x000b8139 _TToFC12FeedReaderApp19TableViewController9tableViewfS0_FTCSo11UITableView23didSelectRowAtIndexPathCSo11NSIndexPath_T_ + 89
    7   UIKit                               0x00e1d9a1 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1513
    8   UIKit                               0x00e1db14 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 279
    9   UIKit                               0x00e2210e __38-[UITableView touchesEnded:withEvent:]_block_invoke + 43
    10  UIKit                               0x00d510aa ___afterCACommitHandler_block_invoke + 15
    11  UIKit                               0x00d51055 _applyBlockToCFArrayCopiedToStack + 403
    12  UIKit                               0x00d50e76 _afterCACommitHandler + 532
    13  CoreFoundation                      0x0066e36e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    14  CoreFoundation                      0x0066e2bf __CFRunLoopDoObservers + 399
    15  CoreFoundation                      0x0064c254 __CFRunLoopRun + 1076
    16  CoreFoundation                      0x0064b9d3 CFRunLoopRunSpecific + 467
    17  CoreFoundation                      0x0064b7eb CFRunLoopRunInMode + 123
    18  GraphicsServices                    0x043a15ee GSEventRunModal + 192
    19  GraphicsServices                    0x043a142b GSEventRun + 104
    20  UIKit                               0x00d33f9b UIApplicationMain + 1225
    21  FeedReaderApp                        0x000bc6ae top_level_code + 78
    22  FeedReaderApp                        0x000bc6eb main + 43
    23  libdyld.dylib                       0x026676d9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

Here's the code of my UITableViewController, that's handling the selection of a table cell:
class TableViewController: UITableViewController, MWFeedParserDelegate {
    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        currentItem = self.items[indexPath.row] as MWFeedItem

        let vc : AnyObject! = self.storyboard?.instantiateViewControllerWithIdentifier("detailView")
        self.showViewController(vc as UIViewController, sender: vc)
    }
}

Thank you for any kind of help!

A:

ios 7 doesn't have the method showViewController, just exist in iOS8
if (self.respondsToSelector(Selector("showViewController"))) 
{
   self.showViewController(vc as UIViewController, sender: vc)
}
else if(self.navigationController.respondsToSelector(Selector("pushViewController")))
{
   self.navigationController!.pushViewController(vs as UIViewController, animated: true)
}

