I am creating a application in swift for both iOS7 & iOS8 compatible. My app runs in iOS8 (as deployment target) easily for both simulator and device. But it's not running in iOS7 as deployment target under "Info" tab. For iOS7, if I choose iPhone 5s(8.1) simulator then it works, but if choose any simulator of 7.0/7.1 sdk/iPhone device, then my app crashes. What should I do? My base SDK on "build settings" tab in xcode is iOS 8.1. Below is my code. My app crashes on "UISearchController(searchResultsController: nil)" of below code. Any suggestion must be appreciable.
override func viewDidLoad() {
super.viewDidLoad()
// Search Controller Setup
searchController = UISearchController(searchResultsController: nil)
searchController.searchBar.delegate = self
searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = false
searchController.searchBar.placeholder = "ব্র্যান্ড/সংস্থা/দোকান খুঁজুন"
// Make sure the that the search bar is visible within the navigation bar.
searchController.searchBar.sizeToFit()
tableView.tableHeaderView = searchController.searchBar
definesPresentationContext = true
}