Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade Xcode8 with Swift3.0?

Tags:

xcode8

swift3

Recently, I have upgraded my Xcode to version8, some strange errors are appear in my console like below:

Painter Z index: 1023 is too large (max 255)
Painter Z index: 1023 is too large (max 255)
Painter Z index: 1023 is too large (max 255)
Painter Z index: 1023 is too large (max 255)
Painter Z index: 1023 is too large (max 255)    
ERROR /BuildRoot/Library/Caches/com.apple.xbs/Sources/VectorKit_Sim/VectorKit-1228.30.7.17.9/GeoGL/GeoGL/GLCoreContext.cpp 1763: InfoLog SolidRibbonShader:
ERROR /BuildRoot/Library/Caches/com.apple.xbs/Sources/VectorKit_Sim/VectorKit-1228.30.7.17.9/GeoGL/GeoGL/GLCoreContext.cpp 1764: WARNING: Output of vertex shader 'v_gradient' not read by fragment shader

Any expert know how to deal with it?

Thank you in advanced.

like image 897
Kevin Avatar asked Sep 21 '16 08:09

Kevin


1 Answers

The freezing problem happens only when run from Xcode 8.0 and only on iOS 10, whether in debug or release mode. MKMapView though seems fine when the app is distributed via App Store or 3rd party ad hoc distribution systems. The warnings you are seeing may or may not be related to the problem, I don't know.

What I've found is that the offending code is in MKMapView's destructor, and it doesn't matter what you do with the map view object or how you configure it, i.e. merely calling

#ViewController.h
@property(nonatomic,strong)MKMapView *mapView;
@end

anywhere in your code will freeze the app. The main thread hangs on a semaphore and it's not clear why

NOTE: this is a really sh*tty workaround but at least it will help you to debug your app without freezing. Retaining these objects means your memory usage will grow by about 45-50MB every time you create a view controller with a map.

So, let's say if you have a property mapView, then you can do this in your view controller's dealloc:

#ViewController.m
@interface ViewController ()
{

}
@end
@implementation ViewController


//the freezing problem happens only when run from Xcode 8.0
- (void)dealloc
{
#if DEBUG
// Xcode8/iOS10 MKMapView bug workaround
static NSMutableArray* unusedObjects;
if (!unusedObjects)
    unusedObjects = [NSMutableArray new];
[unusedObjects addObject:mapView];
#endif
}

@end
like image 149
SG iOS Developer Avatar answered Sep 17 '22 15:09

SG iOS Developer