Unable to use my application to iOS 13

Hi guys,


I need help, my application is running fine on iOS 12 and below but when I tried to run on iOS 13 or later it crash. I did some research, and I tried to remove the UIScene dalegate and all method related on it. I remove also the manifes on info.plist but there is no luck. The crash starts when I load the data into UICollectionview. I have debug log but the problem I do not understant what log trying to say. here is the last log before crash


2020-03-11 17:04:44.999143+0300 Support[2749:203518] [Animation] +[UIView setAnimationsEnabled:] being called from a background thread. Performing any operation from a background thread on UIView or a subclass is not supported and may result in unexpected and insidious behavior. trace=(

0 UIKitCore 0x00007fff4856a545 kFixedAnimationDuration_block_invoke_3 + 119

1 libdispatch.dylib 0x000000010ceded48 _dispatch_client_callout + 8

2 libdispatch.dylib 0x000000010cee0297 _dispatch_once_callout + 66

3 UIKitCore 0x00007fff4856a4cc +[UIView(Animation) setAnimationsEnabled:] + 62

4 UIKitCore 0x00007fff4856a620 +[UIView(Animation) performWithoutAnimation:] + 78

5 UIKitCore 0x00007fff48529bbc -[UIImageView _updateImageViewForOldImage:newImage:] + 526

6 UIKitCore 0x00007fff48522e92 -[UIImageView setImage:] + 473

7 UIKitCore 0x00007fff480734ed -[UIActivityIndicatorView _tearDownAnimation] + 533

8 UIKitCore 0x00007fff48073558 -[UIActivityIndicatorView stopAnimating] + 27

9 Support 0x000000010bf6abfa $s7Support14ViewControllerC7getUser0E08PasswordySS_SStFy10Foundation4DataVSg_So13NSURLResponseCSgs5Error_pSgtcfU_ + 1866

10 Support 0x000000010bf6b031 $s7Support14ViewControllerC7getUser0E08PasswordySS_SStFy10Foundation4DataVSg_So13NSURLResponseCSgs5Error_pSgtcfU_TA + 49

11 Support 0x000000010bf6b1b3 $s10Foundation4DataVSgSo13NSURLResponseCSgs5Error_pSgIegggg_So6NSDataCSgAGSo7NSErrorCSgIeyByyy_TR + 307

12 CFNetwork 0x00007fff22d9a1f8 CFNetwork + 37368

13 CFNetwork 0x00007fff22dad3a6 _CFHTTPMessageSetResponseProxyURL + 16819

14 Foundation 0x00007fff25752d51 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7

15 Foundation 0x00007fff25752c49 -[NSBlockOperation main] + 98

16 Foundation 0x00007fff25755bd6 __NSOPERATION_IS_INVOKING_MAIN__ + 17

17 Foundation 0x00007fff25751e49 -[NSOperation start] + 731

18 Foundation 0x00007fff25756530 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17

19 Foundation 0x00007fff2575603a __NSOQSchedule_f + 182

20 libdispatch.dylib 0x000000010ceed3c9 _dispatch_block_async_invoke2 + 83

21 libdispatch.dylib 0x000000010ceded48 _dispatch_client_callout + 8

22 libdispatch.dylib 0x000000010cee16ba _dispatch_continuation_pop + 552

23 libdispatch.dylib 0x000000010cee0ac5 _dispatch_async_redirect_invoke + 849

24 libdispatch.dylib 0x000000010cef028c _dispatch_root_queue_drain + 351

25 libdispatch.dylib 0x000000010cef0b96 _dispatch_worker_thread2 + 132

26 libsystem_pthread.dylib 0x00007fff5245f6b3 _pthread_wqthread + 583

27 libsystem_pthread.dylib 0x00007fff5245f3fd start_wqthread + 13

)

2020-03-11 17:04:45.891324+0300 Support[2749:203518] [Assert] Cannot be called with asCopy = NO on non-main thread.

2020-03-11 17:04:45.891592+0300 Support[2749:203518] [Assert] Cannot be called with asCopy = NO on non-main thread.

2020-03-11 17:04:45.891831+0300 Support[2749:203518] [Assert] Cannot be called with asCopy = NO on non-main thread.

2020-03-11 17:04:45.891960+0300 Support[2749:203518] [Assert] Cannot be called with asCopy = NO on non-main thread.

G-115

G-115

2020-03-11 17:04:45.923117+0300 Support[2749:203518] [Assert] Cannot be called with asCopy = NO on non-main thread.

2020-03-11 17:04:45.923324+0300 Support[2749:203518] [Assert] Cannot be called with asCopy = NO on non-main thread.

2020-03-11 17:04:45.923828+0300 Support[2749:203518] [Assert] Cannot be called with asCopy = NO on non-main thread.

2020-03-11 17:04:45.923992+0300 Support[2749:203518] [Assert] Cannot be called with asCopy = NO on non-main thread.

2020-03-11 17:04:45.924180+0300 Support[2749:203518] [Assert] Cannot be called with asCopy = NO on non-main thread.

2020-03-11 17:04:45.924304+0300 Support[2749:203518] [Assert] Cannot be called with asCopy = NO on non-main thread.

2020-03-11 17:04:45.924444+0300 Support[2749:203518] [Assert] Cannot be called with asCopy = NO on non-main thread.

2020-03-11 17:04:45.924588+0300 Support[2749:203518] [Assert] Cannot be called with asCopy = NO on non-main thread.

2020-03-11 17:04:45.924740+0300 Support[2749:203518] [Assert] Cannot be called with asCopy = NO on non-main thread.

2020-03-11 17:04:45.924882+0300 Support[2749:203518] [Assert] Cannot be called with asCopy = NO on non-main thread.

2020-03-11 17:04:45.925438+0300 Support[2749:203518] [Assert] Cannot be called with asCopy = NO on non-main thread.

2020-03-11 17:04:45.925682+0300 Support[2749:203518] [Assert] Cannot be called with asCopy = NO on non-main thread.

2020-03-11 17:04:45.966983+0300 Support[2749:203518] *** Assertion failure in -[FBSSerialQueue assertOnQueue], /BuildRoot/Library/Caches/com.apple.xbs/Sources/FrontBoardServices_Sim/FrontBoard-626.4.1/FrontBoardServices/FBSSerialQueue.m:98

2020-03-11 17:04:46.379715+0300 Support[2749:203518] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'threading violation: expected the main thread'

*** First throw call stack:

(

0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350

1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48

2 CoreFoundation 0x00007fff23c70ff8 +[NSException raise:format:arguments:] + 88

3 Foundation 0x00007fff256e9b51 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191

4 FrontBoardServices 0x00007fff366219cb -[FBSSerialQueue assertOnQueue] + 236

5 FrontBoardServices 0x00007fff365d46f9 -[FBSSceneImpl updateClientSettings:withTransitionContext:] + 70

6 FrontBoardServices 0x00007fff365d4944 -[FBSSceneImpl updateClientSettingsWithTransitionBlock:] + 154

7 FrontBoardServices 0x00007fff365d4869 -[FBSSceneImpl updateClientSettingsWithBlock:] + 110

8 UIKitCore 0x00007fff47bd9088 -[FBSScene(UIApp) updateUIClientSettingsWithBlock:] + 160

9 UIKitCore 0x00007fff477d0aa6 -[_UISystemAppearanceManager updateScreenEdgesDeferringSystemGestures] + 374

10 UIKitCore 0x00007fff47a33d76 __70-[UIViewController setNeedsUpdateOfScreenEdgesDeferringSystemGestures]_block_invoke_2 + 118

11 UIKitCore 0x00007fff47a12091 -[UIViewController _updateSystemAppearanceWithRecursionBlock:action:] + 295

12 UIKitCore 0x00007fff47a339bd -[UIViewController _setPresentedStatusBarViewController:] + 220

13 UIKitCore 0x00007fff47a23d9e -[UIViewController _presentViewController:modalSourceViewController:presentationController:animationController:interactionController:completion:] + 1439

14 UIKitCore 0x00007fff47a25798 -[UIViewController _presentViewController:withAnimationController:completion:] + 4349

15 UIKitCore 0x00007fff47a2801b __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 98

16 UIKitCore 0x00007fff47a28533 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 511

17 UIKitCore 0x00007fff47a27f79 -[UIViewController _presentViewController:animated:completion:] + 187

18 UIKitCore 0x00007fff47a281e0 -[UIViewController presentViewController:animated:completion:] + 150

19 UIKitCore 0x00007fff481f40ed __74-[UIStoryboardPresentationSegueTemplate newDefaultPerformHandlerForSegue:]_block_invoke + 133

20 UIKitCore 0x00007fff481f9ec4 -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 276

21 UIKitCore 0x00007fff481f9d82 -[UIStoryboardSegueTemplate _perform:] + 82

22 UIKitCore 0x00007fff47a16fa3 -[UIViewController performSegueWithIdentifier:sender:] + 99

23 Support 0x000000010bf6ac92 $s7Support14ViewControllerC7getUser0E08PasswordySS_SStFy10Foundation4DataVSg_So13NSURLResponseCSgs5Error_pSgtcfU_ + 2018

24 Support 0x000000010bf6b031 $s7Support14ViewControllerC7getUser0E08PasswordySS_SStFy10Foundation4DataVSg_So13NSURLResponseCSgs5Error_pSgtcfU_TA + 49

25 Support 0x000000010bf6b1b3 $s10Foundation4DataVSgSo13NSURLResponseCSgs5Error_pSgIegggg_So6NSDataCSgAGSo7NSErrorCSgIeyByyy_TR + 307

26 CFNetwork 0x00007fff22d9a1f8 CFNetwork + 37368

27 CFNetwork 0x00007fff22dad3a6 _CFHTTPMessageSetResponseProxyURL + 16819

28 Foundation 0x00007fff25752d51 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7

29 Foundation 0x00007fff25752c49 -[NSBlockOperation main] + 98

30 Foundation 0x00007fff25755bd6 __NSOPERATION_IS_INVOKING_MAIN__ + 17

31 Foundation 0x00007fff25751e49 -[NSOperation start] + 731

32 Foundation 0x00007fff25756530 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17

33 Foundation 0x00007fff2575603a __NSOQSchedule_f + 182

34 libdispatch.dylib 0x000000010ceed3c9 _dispatch_block_async_invoke2 + 83

35 libdispatch.dylib 0x000000010ceded48 _dispatch_client_callout + 8

36 libdispatch.dylib 0x000000010cee16ba _dispatch_continuation_pop + 552

37 libdispatch.dylib 0x000000010cee0ac5 _dispatch_async_redirect_invoke + 849

38 libdispatch.dylib 0x000000010cef028c _dispatch_root_queue_drain + 351

39 libdispatch.dylib 0x000000010cef0b96 _dispatch_worker_thread2 + 132

40 libsystem_pthread.dylib 0x00007fff5245f6b3 _pthread_wqthread + 583

41 libsystem_pthread.dylib 0x00007fff5245f3fd start_wqthread + 13

)

libc++abi.dylib: terminating with uncaught exception of type NSException

Accepted Reply

All UI operations need to be done on the main thread, and this text is letting you know that an animation is proceeding from a background thread:

+[UIView setAnimationsEnabled:] being called from a background thread. Performing any operation from a background thread on UIView or a subclass is not supported and may result in unexpected and insidious behavior.

and then again later:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'threading violation: expected the main thread'

Looking at your backtrace further, you're getting the response from a network request on a background thread, and then directly calling into UIKit from there.

  8   UIKitCore                           0x00007fff48073558 -[UIActivityIndicatorView stopAnimating] + 27
  9   Support                             0x000000010bf6abfa $s7Support14ViewControllerC7getUser0E08PasswordySS_SStFy10Foundation4DataVSg_So13NSURLResponseCSgs5Error_pSgtcfU_ + 1866
  10  Support                             0x000000010bf6b031 $s7Support14ViewControllerC7getUser0E08PasswordySS_SStFy10Foundation4DataVSg_So13NSURLResponseCSgs5Error_pSgtcfU_TA + 49
  11  Support                             0x000000010bf6b1b3 $s10Foundation4DataVSgSo13NSURLResponseCSgs5Error_pSgIegggg_So6NSDataCSgAGSo7NSErrorCSgIeyByyy_TR + 307
  12  CFNetwork                           0x00007fff22d9a1f8 CFNetwork + 37368
  13  CFNetwork                           0x00007fff22dad3a6 _CFHTTPMessageSetResponseProxyURL + 16819

You need to move all of the UIKit code back to the main thread, such as with an async Dispatch block.

Replies

All UI operations need to be done on the main thread, and this text is letting you know that an animation is proceeding from a background thread:

+[UIView setAnimationsEnabled:] being called from a background thread. Performing any operation from a background thread on UIView or a subclass is not supported and may result in unexpected and insidious behavior.

and then again later:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'threading violation: expected the main thread'

Looking at your backtrace further, you're getting the response from a network request on a background thread, and then directly calling into UIKit from there.

  8   UIKitCore                           0x00007fff48073558 -[UIActivityIndicatorView stopAnimating] + 27
  9   Support                             0x000000010bf6abfa $s7Support14ViewControllerC7getUser0E08PasswordySS_SStFy10Foundation4DataVSg_So13NSURLResponseCSgs5Error_pSgtcfU_ + 1866
  10  Support                             0x000000010bf6b031 $s7Support14ViewControllerC7getUser0E08PasswordySS_SStFy10Foundation4DataVSg_So13NSURLResponseCSgs5Error_pSgtcfU_TA + 49
  11  Support                             0x000000010bf6b1b3 $s10Foundation4DataVSgSo13NSURLResponseCSgs5Error_pSgIegggg_So6NSDataCSgAGSo7NSErrorCSgIeyByyy_TR + 307
  12  CFNetwork                           0x00007fff22d9a1f8 CFNetwork + 37368
  13  CFNetwork                           0x00007fff22dad3a6 _CFHTTPMessageSetResponseProxyURL + 16819

You need to move all of the UIKit code back to the main thread, such as with an async Dispatch block.