1

Good evening. I'm developing for iOS for some years now and I'm experiencing a strange issue ever since iOS8 was released. I was assure it will be fixed but it's 8.1.2 now and it's still happening. On iOS7 everything is working fine but on a phone running iOS8 something strange happens.

The Problem:
The application turns black randomly. the application is still running as the debugger not firing with an exception. It happens on iPhone 4,5,6 running iOS8 and not on iOS7. I can not predict the black screen.
I tried opening a new project but the same: random black screen.
Anyone else experiencing this? Any idea on how to fix this? It's really annoying.
Thank you so much in advance!

P.S: I'm developing in Swift if it makes any difference.

user2558461
  • 281
  • 1
  • 6
  • 21
  • 2
    It's hard to tell from your description… Hopefully your phone doesn't switch to standby or you accidentally hit the standby button… But in case not, can you post any logs? Does it happen if you stay on the first screen and if yes can you post some view controller code to possibly identify the issue? Do you have any network interaction (network interaction might take random time and maybe something goes wrong right after the response… – Alexander Jan 16 '15 at 12:37
  • There are no logs since the app is still running, and it happened on many phones. The only thing all has is iOS8+. It happens randomly. If I click on the black screen I get something about wrong window – user2558461 Jan 16 '15 at 15:26
  • I wasn't asking for carshlogs but logs, which can be "printed" even if the app is running (e.g. NSLog). Further I was asking if this crash occurs if you stay at the starting screen. Then I was asking about network activity. Have you even read my question? Your statment "something about wrong window" is very vague. What exactly is the error/message/log/... you are getting. If you want help, give out as much information as possible. If you don't, do not wonder why nobody will answer! – Alexander Jan 16 '15 at 17:06
  • I tried giving all the information I have. I can't log since it happens randomly. It didn't happen in the first screen though only after some traveling but not in the same view controller I said I even tried new project with almost no code. I hoped it's iOS 8 bug.. Hoped someone experienced it. I don't think it's related to network – user2558461 Jan 16 '15 at 21:45
  • You mention something about a wrong window. Are you using the `UIWindow` class directly in your app? (eg. showing an overlay, custom pop-up, etc.) Are you using Storyboards? – Jernej Strasner Jan 18 '15 at 22:06
  • 1
    Check your Xcode breakpoints for invalid debugger actions. I had a similar problem where my code would crash on iOS 8, but the app would appear to hang, because the debugger was unable to execute an old breakpoint action. –  Jan 19 '15 at 01:26
  • When it happens, what does View Debugging show? https://developer.apple.com/library/ios/recipes/xcode_help-debugger/using_view_debugger/using_view_debugger.html – Andy Riordan Jan 21 '15 at 00:39
  • Did you try to make a clean install of Xcode? – Nicholas Jan 23 '15 at 11:50
  • 2
    @user2558461 Hi there! Now I have the same issue so interested how you fixed it or found any other solution? – sage444 Apr 29 '15 at 14:15
  • me too. have either of you been able to fix it? – vinnybad May 04 '15 at 16:26

3 Answers3

2

I had the same problem :

  1. Go to the iOS simulator menu and choose Reset Content and Settings...
  2. Close xCode
  3. Delete the contents of the DerivedData folder (~/Library/Developer/Xcode/DerivedData)
  4. Delete (~/Library/Caches/com.apple.dt.Xcode)

Now launch Xcode…

Pixel
  • 1,946
  • 2
  • 15
  • 26
  • 1
    I think that making such a cleaning everything will be work again. I usually clear these files/folders in order to stabilize Xcode. Good answer! – Nicholas Jan 23 '15 at 11:52
0

You can give your main UIWindow background color and check if your view is being removed for some reason.

[[[UIApplication sharedApplication] delegate] window].backgroundColor = [UIColor redColor]

I am not sure but you can try.

  • The developer language is Swift and it cannot be related to a View since this is happening randomly. – Nicholas Jan 23 '15 at 11:51
0

I had the same black screen problem using storyboard UINavigationController with two sequed UIViewcontrollers. My rootwiew controller would flash on screen followed by the black screen. After much researching of the problem I found a hint which stated that your code must be in the correct order when the app launches.

My original code under FinishedLaunching method:-

UIStoryboard storyBoard = UIStoryboard.FromName("MainStoryboard", NSBundle.MainBundle);
var navController = storyboard.InstantiateViewController(navigationController);
window.RootViewController = navController;
window.MakeKeyAndVisible();

This provided my root view controller followed by the black screen.

Simply moving window.MakeKeyAndVisible(); from FinishedLaunching method into the OnActivated method gives me a working app with page navigation back and forth with no errors and no black screen.

user3763081
  • 43
  • 2
  • 8