Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UISplitViewController in XCode 6 for iOS 7 app

I'm working on an iPad only application with UISplitViewController using Xcode 6 and Swift. The app should support iOS 7.1 and higher. I set the deployment target for the project to iOS 7.1 and kept SDK version at 8.0 to support Swift. I had a working version with Xcode 6 beta 6 but the application no longer works on iOS 7.1 (simulator and device) after upgrading Xcode to the gold master version.

Even a blank application created from the master detail template provided by Xcode GM does not work on iOS 7.1. I already disabled the displayModeButtonItem in the generated AppDelegate of the blank application as this is not supported on iOS 7 but the app crashes on the first line of the didFinishLaunchingWithOption delegate method.

The code

func application(application: UIApllication, didFinishLaunchingWithOptions: [NSObject: AnyObject]?) -> Bool {
    let splitViewController = self.windows!.rootViewController as UISplitViewController
    let navigationController = splitViewController.viewControllers[splitViewContoller.viewControllers.count-1] as UINavigationController
    splitViewController.delegate = self
}

results in a bad access exception in the first line.

Is it even possible to write a split view application for iOS 7 using Xcode 6? The differences in UISplitViewController between iOS SDKs 7 and 8 are huge. Looking at the class reference in Apples SDK documentation it looks like a complete rewrite of UISplitViewController.

Edit: I just realised that after opening the storyboard of my app in Xcode 6 GM or Xcode 6.0.1 some version information inside the XML got changed. If I revert these changes and recompile my app without opening the storyboard in Xcode 6 GM or 6.0.1 the app works fine in iOS 7.1.

Edit (10/21/2014): Problem still exists in XCode 6.1.

like image 585
Kay Zumbusch Avatar asked Sep 18 '14 14:09

Kay Zumbusch


1 Answers

I was stuck on a similar issue. Turning off size classes fixed it for me.

In the storyboard, on the right pane, click "Show the file inspector" (paper looking icon), and uncheck "Use Size Classes" just under the auto layout setting.

like image 124
Brian Broom Avatar answered Nov 10 '22 18:11

Brian Broom