简体   繁体   中英

Upgrade Xcode8 with Swift3.0?

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.

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, ie 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM