2015-12-02 23 views
1

我不明白它来自哪里...我不知道它是否它是链接的,但我将一个“activityIndi​​cator”和一个“statusLabel”从一个视图传递到另一个视图,这是问题吗?“此应用程序正在修改后台线程的自动布局引擎,这可能会导致引擎损坏和奇怪的崩溃....”

This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release. 
    Stack:(
     0 CoreFoundation      0x246cf883 <redacted> + 150 
     1 libobjc.A.dylib      0x35dcedff objc_exception_throw + 38 
     2 CoreFoundation      0x246cf7b1 <redacted> + 0 
     3 Foundation       0x2556be63 <redacted> + 170 
     4 Foundation       0x25411ba7 <redacted> + 38 
     5 UIKit        0x288e3aa9 <redacted> + 52 
     6 UIKit        0x288e4487 <redacted> + 222 
     7 UIKit        0x28fbcfa5 <redacted> + 288 
     8 UIKit        0x28ad5fa9 <redacted> + 148 
     9 UIKit        0x287dd6bb <redacted> + 694 
     10 QuartzCore       0x280a967d <redacted> + 128 
     11 QuartzCore       0x280a4d79 <redacted> + 352 
     12 QuartzCore       0x280a4c09 <redacted> + 16 
     13 QuartzCore       0x280a4129 <redacted> + 368 
     14 QuartzCore       0x280a3deb <redacted> + 590 
     15 QuartzCore       0x280d1777 <redacted> + 310 
     16 libsystem_pthread.dylib    0x36666921 <redacted> + 508 
     17 libsystem_pthread.dylib    0x36666523 <redacted> + 86 
     18 libsystem_pthread.dylib    0x36667499 pthread_exit + 28 
     19 Foundation       0x253e9787 <redacted> + 10 
     20 Foundation       0x254a481f <redacted> + 1178 
     21 libsystem_pthread.dylib    0x36667c93 <redacted> + 138 
     22 libsystem_pthread.dylib    0x36667c07 _pthread_start + 110 
     23 libsystem_pthread.dylib    0x36665a24 thread_start + 8 
    ) 
    2015-12-02 11:35:03.138 QRCodeReader[735:277009] This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release. 
    Stack:(
     0 CoreFoundation      0x246cf883 <redacted> + 150 
     1 libobjc.A.dylib      0x35dcedff objc_exception_throw + 38 
     2 CoreFoundation      0x246cf7b1 <redacted> + 0 
     3 Foundation       0x2556be63 <redacted> + 170 
     4 Foundation       0x25411ba7 <redacted> + 38 
     5 UIKit        0x288e3aa9 <redacted> + 52 
     6 UIKit        0x28fbc9d9 <redacted> + 132 
     7 UIKit        0x288e478b <redacted> + 86 
     8 Foundation       0x25411c81 <redacted> + 256 
     9 UIKit        0x288e3aa9 <redacted> + 52 
     10 UIKit        0x288e4487 <redacted> + 222 
     11 UIKit        0x28fbcfa5 <redacted> + 288 
     12 UIKit        0x28ad5fa9 <redacted> + 148 
     13 UIKit        0x287dd6bb <redacted> + 694 
     14 QuartzCore       0x280a967d <redacted> + 128 
     15 QuartzCore       0x280a4d79 <redacted> + 352 
     16 QuartzCore       0x280a4c09 <redacted> + 16 
     17 QuartzCore       0x280a4129 <redacted> + 368 
     18 QuartzCore       0x280a3deb <redacted> + 590 
     19 QuartzCore       0x280d1777 <redacted> + 310 
     20 libsystem_pthread.dylib    0x36666921 <redacted> + 508 
     21 libsystem_pthread.dylib    0x36666523 <redacted> + 86 
     22 libsystem_pthread.dylib    0x36667499 pthread_exit + 28 
     23 Foundation       0x253e9787 <redacted> + 10 
     24 Foundation       0x254a481f <redacted> + 1178 
     25 libsystem_pthread.dylib    0x36667c93 <redacted> + 138 
     26 libsystem_pthread.dylib    0x36667c07 _pthread_start + 110 
     27 libsystem_pthread.dylib    0x36665a24 thread_start + 8 
    ) 
    2015-12-02 11:35:03.150 QRCodeReader[735:277009] This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release. 
    Stack:(
     0 CoreFoundation      0x246cf883 <redacted> + 150 
     1 libobjc.A.dylib      0x35dcedff objc_exception_throw + 38 
     2 CoreFoundation      0x246cf7b1 <redacted> + 0 
     3 Foundation       0x2556be63 <redacted> + 170 
     4 Foundation       0x254160ef <redacted> + 38 
     5 Foundation       0x25411ceb <redacted> + 362 
     6 UIKit        0x288e3aa9 <redacted> + 52 
     7 UIKit        0x288e4487 <redacted> + 222 
     8 UIKit        0x28fbcfa5 <redacted> + 288 
     9 UIKit        0x28ad5fa9 <redacted> + 148 
     10 UIKit        0x287dd6bb <redacted> + 694 
     11 QuartzCore       0x280a967d <redacted> + 128 
     12 QuartzCore       0x280a4d79 <redacted> + 352 
     13 QuartzCore       0x280a4c09 <redacted> + 16 
     14 QuartzCore       0x280a4129 <redacted> + 368 
     15 QuartzCore       0x280a3deb <redacted> + 590 
     16 QuartzCore       0x280d1777 <redacted> + 310 
     17 libsystem_pthread.dylib    0x36666921 <redacted> + 508 
     18 libsystem_pthread.dylib    0x36666523 <redacted> + 86 
     19 libsystem_pthread.dylib    0x36667499 pthread_exit + 28 
     20 Foundation       0x253e9787 <redacted> + 10 
     21 Foundation       0x254a481f <redacted> + 1178 
     22 libsystem_pthread.dylib    0x36667c93 <redacted> + 138 
     23 libsystem_pthread.dylib    0x36667c07 _pthread_start + 110 
     24 libsystem_pthread.dylib    0x36665a24 thread_start + 8 
    ) 

为了更精确: 在第一类中,我通过activityIndi​​cator和statusLabel:

[DataManagementObj WebServiceLogin: activityIndicator withLabel:statusLabel]; 

在它正在等待应答服务器精加工第二类:

-(void)connectionDidFinishLoading:(NSURLConnection *)connection 
    { 
     NSLog(@"connectionDidFinishLoading"); 

     // OTHER CODE HERE TO HANDLE THE RESPONSE.... 
     NSLog(@"connection url : %@", connection.currentRequest.URL); 
     NSLog(@"connection url : %@", [NSURL URLWithString:get_device_list_from_retailer_WS]); 

     if ([connection.currentRequest.URL isEqual: [NSURL URLWithString:login_WS]]) 
     { 
      NSError* error; 
      NSDictionary* response = [NSJSONSerialization JSONObjectWithData:receivedData options:kNilOptions error:&error]; 
      NSLog(@"%@",[response objectForKey:@"key"]); 
      int key = [[response objectForKey:@"key"] integerValue]; 
      [self updateUser:key]; 
    ======>[self stopSynchronizationAnimation]; 
     } 
     else if ([connection.currentRequest.URL isEqual: [NSURL URLWithString:get_retailer_list_from_wholesaler_WS]]) 
     { 
      NSError* error; 
      NSDictionary* response = [NSJSONSerialization JSONObjectWithData:receivedData options:kNilOptions error:&error]; 
      [self updateRetailerList: response]; 
    ======>[self stopSynchronizationAnimation]; 
     } 
     else if ([connection.currentRequest.URL isEqual: [NSURL URLWithString:get_device_list_from_wholesaler_WS]]) 
     { 
      NSError* error; 
      NSDictionary* response = [NSJSONSerialization JSONObjectWithData:receivedData options:kNilOptions error:&error]; 
      [self update3TablesList: response]; 
    ======>[self stopSynchronizationAnimation]; 

    etc... 

如果有人有任何想法?非常感谢。

+0

您正在从后台线程操纵UI元素。你只应该从主线程操纵UI元素。 –

+0

您需要查看您正在执行异步操作的位置 - 您获得回调的位置;如果这些位于后台线程上,则需要在主队列上调度UI更新 – Paulw11

+0

您是否有任何关闭,试图更改视图的布局或仅设置UIlabel中的文本? – abarbier

回答

4

您必须切换到主线程才能调用用户界面代码。最简单的方法是dispatch_async(dispatch_get_main_queue()

dispatch_async(dispatch_get_main_queue(), ^(){ 
    [self stopSynchronizationAnimation]; 
    // reload data on collection view or table view 
}); 
+0

它完美的作品。谢谢 :) – Claudio

相关问题