6

私のゲーム エンジンには、マルチスレッド レンダリングを有効にするオプションがあります。iOS 12 (およびそれ以下) では、アプリはクラッシュしませんでした。

コードは何も変更していませんが、iOS 13 でクラッシュします。

2019-10-02 11:36:07.931 SimpleGame[293:11150] ---> (Inner Exception #0) Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: threading violation: expected the main thread

Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    0   CoreFoundation                      0x00000001aace1c44 97285ACB-7B21-393A-ABF6-03F1DBB5D2A2 + 1256516
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    1   libobjc.A.dylib                     0x00000001aa9fc0c8 objc_exception_throw + 60
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    2   CoreFoundation                      0x00000001aabde75c 97285ACB-7B21-393A-ABF6-03F1DBB5D2A2 + 194396
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    3   Foundation                          0x00000001ab01f960 672CF0CB-4951-3B91-89DF-55E953AEA00F + 571744
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    4   FrontBoardServices                  0x00000001afe9791c 124B166D-3905-3F51-A46A-646AE3424213 + 366876
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    5   FrontBoardServices                  0x00000001afe4a288 124B166D-3905-3F51-A46A-646AE3424213 + 49800
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    6   UIKitCore                           0x00000001ae51a87c 55D60569-DBB7-3BC9-8A97-DCAC95C64D4B + 1915004
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    7   UIKitCore                           0x00000001ae517554 55D60569-DBB7-3BC9-8A97-DCAC95C64D4B + 1901908
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    8   UIKitCore                           0x00000001ae5177b4 55D60569-DBB7-3BC9-8A97-DCAC95C64D4B + 1902516
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    9   UIKitCore                           0x00000001aeface14 55D60569-DBB7-3BC9-8A97-DCAC95C64D4B + 13000212
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    10  UIKitCore                           0x00000001aedaf02c 55D60569-DBB7-3BC9-8A97-DCAC95C64D4B + 10911788
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    11  UIKitCore                           0x00000001aedaff00 55D60569-DBB7-3BC9-8A97-DCAC95C64D4B + 10915584
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    12  
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    22  SimpleGame                   0x000000010487c2a4 World_FlushRenderWorkQueue_private + 2577804
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    23  SimpleGame                   0x00000001048b45e8 World_FlushRenderWorkQueue_private + 2808016
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    24  SimpleGame                   0x00000001048b54c0 World_FlushRenderWorkQueue_private + 2811816
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    25  SimpleGame                   0x00000001051d7198 World_FlushRenderWorkQueue_private + 12387456
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    26  SimpleGame                   0x000000010503c058 World_FlushRenderWorkQueue_private + 10703680
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    27  SimpleGame                   0x000000010503b774 World_FlushRenderWorkQueue_private + 10701404
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    28  SimpleGame                   0x00000001051d5400 World_FlushRenderWorkQueue_private + 12379880
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    29 SimpleGame                   0x000000010487d904 World_FlushRenderWorkQueue_private + 2583532
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    30  SimpleGame                   0x000000010487c2a4 World_FlushRenderWorkQueue_private + 2577804
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    31  SimpleGame                   0x000000010487c038 World_FlushRenderWorkQueue_private + 2577184
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    32  SimpleGame                   0x000000010487da00 World_FlushRenderWorkQueue_private + 2583784
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    33  SimpleGame                   0x00000001047081a8 World_FlushRenderWorkQueue_private + 1053840
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    34  SimpleGame                   0x0000000105bb1434 World_FlushRenderWorkQueue_private + 22718236
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    35  SimpleGame                   0x0000000105c18dd4 World_FlushRenderWorkQueue_private + 23142588
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    36  PSimpleGame                   0x0000000105c44080 World_FlushRenderWorkQueue_private + 23319400
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    37  libsystem_pthread.dylib             0x00000001aa9ecd5c _pthread_start + 128
Oct  2 09:57:48 GL04207-MT SimpleGame[923] <Notice>:    38  libsystem_pthread.dylib             0x00000001aa9f4c84 thread_start + 8

マルチスレッド レンダリング オプションを無効にしても、クラッシュしませんでした。iOS 13 のスレッド システムに変更があるはずですが、ドキュメントからは何も見つかりませんでした。

4

1 に答える 1

8

Gene が言ったように、問題は、バックグラウンド スレッドから UI を誤って操作した場合、以前のバージョンの iOS が停止しないことです。iOS 13 はそうします。

問題を特定するには、[エディタ] » [スキーム] » [スキームの編集...] に移動し、[メイン スレッド チェッカー] をチェックします。この横にある右矢印をタップすると、問題のブレークポイントが作成され、バックグラウンド スレッドから UI を更新しようとしている行で実行が停止します。

ここに画像の説明を入力

于 2019-10-02T17:40:31.520 に答える