Alexander Yatsenko Alexander Yatsenko - 1 month ago 13
Objective-C Question

iOS 10 update black screen my app, reinstall helps, restart the app - no

I have a corporate(with corp apple licence) app, it's kind of social network of company, it's about 1200 users with iOS 10 and some of them (~2%) report that app can fall in black screen and nothing helps(kill app and reboot of device useless), only delete app and install again. It could happen any time even right away first time launch, or can work for a week fine, and then black screen. I think it's problem with iOS 10 and corporate licence, but i can't be sure because i still can't get a device with this problem.

App is in Obj-C. No xibs or storyboard. On iOS 6 - 9 everything fine.

Dose anyone face the same problem?

Answer

The black screen appears on iOS 10 if app have an active download session and the user kills the app(or it crushes). Device reboot dose not help.

The solution i've found: You have to generate random part of download session identifier.

NSString *seed = [NSString stringWithFormat:@"%ul", arc4random()];
NSString *identifier = [NSString stringWithFormat:@"com.company.app.%@", seed];
NSURLSessionConfiguration *sessionConfiguration = nil;
if([NSURLSessionConfiguration respondsToSelector:@selector(backgroundSessionConfigurationWithIdentifier:)])
    sessionConfiguration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:identifier];
else
    sessionConfiguration = [NSURLSessionConfiguration backgroundSessionConfiguration:identifier];