asihttprequest crashes my app

前端 未结 4 485
自闭症患者
自闭症患者 2021-02-06 04:05

I have a navigation based app. Press a button on main view, then I push a new view to the navigation controller. All pretty basic stuff.

When the new view is loaded, I d

4条回答
  •  囚心锁ツ
    2021-02-06 04:44

    You won't find anything better that ASIHTTPRequest, the problem will be how you are using it and vanishing delegates on navigation are a common problem to have to deal with.

    It sounds like your problem relates to the viewcontroller that is handling the queue being destroyed due to user navigation. I find the best way of solving these issues is to have a central model class that handles all my communications and keep that class throughout the application lifecycle.

    That way you don't get unexplained crashes when delegates have vanished unexpectedly.

    Option 2

    Another approach can be to disable user navigation until the network operation completes. Put a modal view over the entire screen that shows a uiactivityview so the user knows their actions are being blocked. Then you can fade the modal view off when the data has arrived. If you design the screen nicely with a gradient so the background just dims a bit, this can look OK. But it's not really the best approach - you should fix the delegate AWOL instead.

    We probably need to see more of the code relating to the queue creation, destruction etc to find the exact issue.

提交回复
热议问题