“Pushing the same view controller instance more than once is not supported” exception

前端 未结 13 1076
独厮守ぢ
独厮守ぢ 2020-12-02 17:04

I am using the following code to retrieve some messages and putting them into my inbox.

MyInboxVC *inboxVC=[MyInboxVC get ];
//upload all the pending messag         


        
13条回答
  •  萌比男神i
    2020-12-02 17:20

    The Main Reason for this problem, obviously if the code that pushed the view controller is called more than once. This could occur for many reasons, most common mistake when a callback method is triggered from a background thread, where this method could be executed more than once while it is still pushing the view controller. Example: Calling a service api on background thread when tapping a button, which will allow you to press the button more than once, and therefore the callback which pushes the view controller get called more than once. @Melvin and @Sam solution is valid as long as you do not want to fix the original problem by not pushing more than once.

提交回复
热议问题