Reputation: 416
I have been trying to run my Xcode project on my iOS simulator an iPhone but I only get a black screen. I have tried multiple solutions but none seem to work.
I have tried:
Setting main interface to "Main.storyboard"
Installing all views i.e.: width: any, height: any
Adding print statement to viewDidLoad
to state that the view did in fact load (didn't print that the view loaded)
Resetting all content of the iOS simulator
Running on my iPhone
Setting initial view controller
None of these have solved my problem
Upvotes: 2
Views: 560
Reputation: 3906
May be you use an empty UIViewController(). In my case I set a default value an empty UIViewController()
Upvotes: 0
Reputation: 19469
Make sure in your AppDelegate that you are creating the variable window like so (right after the app delegate class declaration): var window: UIWindow?
.
Without this line of code, your views will just never launch and your screen will stay black.
Upvotes: 2
Reputation: 111
There might be many reasons for blank black view. But first check whether you have the window variable declared in your appDelegate as suggested by @john. If this doesnt work, check in the storyboard whether you have made your first controller as initial view controller.
You can also do this by adding rootviewController as the view controller you want in the window inside application:didFinishLaunchingWithOptions:
Upvotes: 1