The app delegate must implement the window property if it wants to use a main storyboard file
You are creating your window as a local variable and then trying to access it as if it were a property by using self.window
. Make it a property.
Swift Code in App Delegate to Load Storyboard Causes Crash
Your app delegate needs to start like such:
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
//...
}
Can you set the window in the app/scene delegate and still use storyboard?
Set your root view controller either from SceneDelegate
or from App Delegate
or from the Storyboard
, you don't have to do it in all the places.
If you are just trying to initialize your ViewController
from code you don't need any storyboard and the initializer you called ViewController()
does not instantiate a view controller from the storyboard. to know how you can instantiate a view controller associated with a storyboard please refer to this link.
You can use any view controller as a root view controller it depends on you.
isInitialViewController
sets that view controller as the root view controller of the window.
If you just want to use your ViewController
as the root view controller which you already codded in the app delegate, now just delete the storyboard and its references from info.plist
file then you are good to go.
Specify App Delegate for Storyboard in iOS
did you set mainWindow if you are not please set your window in your project
Related Topics
Uicollectionview Insert Cells Above Maintaining Position (Like Messages.App)
Coremotion Updates in Background State
iOS 9 "Fbauth2" Missing from Info.Plist
How to Use Speech Recognition Inside the iOS Sdk
Front Facing Camera in Uiimagepickercontroller
How to Draw a Transparent Stroke (Or Anyway Clear Part of an Image) on the Iphone
How to Make Return Key on iPhone Make Keyboard Disappear
How to Find Out Distance Between Coordinates
Convert Coordinates to City Name
Check If Location Services Are Enabled
How to Change the Height of a Uinavigationbar in Storyboard Without Using a Uinavigationcontroller
What Advantage(S) Does Dispatch_Sync Have Over @Synchronized
The App Delegate Must Implement the Window Property If It Wants to Use a Main Storyboard File Swift
Xcode 6 Save for Enterprise Deployment Does Not Create Plist for IPA Anymore
Google Maps iOS Sdk, Getting Directions Between 2 Locations
Xcode 8 - Missing Files Warnings