Launch iOS simulator from Xcode and getting a black screen, followed by Xcode hanging and unable to stop tasks

后端 未结 26 2286
一整个雨季
一整个雨季 2020-11-29 05:16

I\'m having trouble running my basic iPhone application (while going through the Stanford iTunes CS193p lectures) in the iOS simulator.

I\'ve been searching for a wh

相关标签:
26条回答
  • 2020-11-29 05:31

    When i have carried my project on Xcode 11.1, i got that problem. That black screen problem may occur any presentation inter ViewControllers.

    That answer helped me. Because modal presentation changed with iOS 13. If you don't get that problem before iOS 13, please try to add line below to your ViewController before its presentation;

    viewController.modalPresentationStyle = .fullScreen
    

    after your code may seem like below;

    let vc = UIViewController()
    vc.modalPresentationStyle = .fullScreen //or .overFullScreen for transparency
    self.present(vc, animated: true, completion: nil)
    
    0 讨论(0)
  • 2020-11-29 05:33

    I am a newbie to the iOS app development. I was practising to develop iOS apps from the very beginning and while running a very basic Hello World app, I also faced same issue that only a black blank screen appears after building and running the app in iOS simulator. Somehow while struggling to find out a solution to the problem I accidentally clicked Window-->Scale-->50% in iOS simulator and it did solve my problem. I could then see the Home page with my app and clicking on app icon I was able to run my app successfully. App versions: Xcode 5.1 iOS Simulator: 7.1 OSX: 10.9.3

    0 讨论(0)
  • 2020-11-29 05:35

    To make sure it's a simulator issue, see if you can connect to the simulator with a brand new project without changing any code. Try the tab bar template.

    If you think it's a simulator issue, press the iOS Simulator menu. Select "Reset Content and Settings...". Press "Reset."

    I can't see your XIB and what @properties you have connected in Interface Builder, but it could also be that you're not loading your window, or that your window is not loading your view controller.

    0 讨论(0)
  • 2020-11-29 05:36

    I've managed to find the fix for this. It was found courtesy of this blog post:

    http://vandadnp.wordpress.com/2012/03/18/xcode-4-3-1-cannot-attach-to-ios-simulator/

    The solution is to press cmd+shift+, (command, shift and then comma ",").. that loads some options for release or debugging.

    Change the debugger from LLDB to GDB. This fixes the issue.

    0 讨论(0)
  • 2020-11-29 05:37

    Another Solution is that if you are building UI programatically in Objective C project, then you might need to add some code to inflate the view, so you will need to add those 3 lines to make the window's interface interacts with the code (the outer 2 are actually interacting with the code and the other one will change the screen to white so you will know it works).

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    self.window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    
    ...
    
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    
    
    return YES;
    }
    
    0 讨论(0)
  • 2020-11-29 05:37

    Please check for all the constraints for all the views and review complete storyboard. Usually this happens because of that.

    Regards, Arora

    0 讨论(0)
提交回复
热议问题