WARNING: Output of vertex shader 'v_gradient' not read by fragment shader

后端 未结 2 1898
野趣味
野趣味 2020-12-02 11:11

When i run my app in ios 10 using xcode 8 i am getting following message in debug console, and by UI getting freezed can any one know why this is happening

         


        
2条回答
  •  广开言路
    2020-12-02 11:51

    Update: the issue seems to be gone now on Xcode9/iOS11.


    Firstly, the freezing problem happens only when run from Xcode 8 and only on iOS 10 (currently 10.0.2), 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

    [MKMapView new];
    

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

    One of the things I've tried was to destroy the map view object in a separate thread but that didn't help. Eventually I decided to retain my map objects at least in DEBUG builds.

    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:

    - (void)dealloc
    {
    #if DEBUG
        // Xcode8/iOS10 MKMapView bug workaround
        static NSMutableArray* unusedObjects;
        if (!unusedObjects)
            unusedObjects = [NSMutableArray new];
        [unusedObjects addObject:_mapView];
    #endif
    }
    

提交回复
热议问题