Any way to debug app with dataset in production environment?

会有一股神秘感。 提交于 2019-12-01 04:05:12

问题


My CloudKit dataset in Production Environment is somewhat bigger than Development, and other exotic difference could exist.

There is a nasty deadlock using my app in Production Mode. Is it possible to debug client in any way? Or should I log as many thing as possible and send somehow out?

It is a threading issue, so without examining threads in Xcode it is really though to do anything. Any idea? I am using Core Data to local storage.


回答1:


  1. Rollback changes in the source code, to be able to run app.
  2. Sync down records from Production Environment to local Core Data Storage.
  3. Copy out in Xcode Device menu the sqlite database from container.
  4. Create an temporary project with same model, populate it with the database.
  5. Set up temporary project to able to use previous CloudKit container.
  6. Reset Development Environment in Dashboard.
  7. Upload all record from temporary project.
  8. Run original project with original source code.



回答2:


I would recommend using a crash reporting service. While there are a few options out there, I worked with Crashlytics, and I was very happy with the reports that they provided, always helping me to fix bugs in production.




回答3:


When the app will go the the background, at some point it will be killed by iOS because your thread won't have answered to the -applicationDidEnterBackground, and then you will get a backtrace of all your threads.

If you want a better chance to trigger the kill (if the locked thread is not the main thread), you could grab a background task (- beginBackgroundTaskWithExpirationHandler:) in your working threads: if they are locked at some point they will never release the background task and they'll trigger the kill.

Now just wait for the iOS scheduler to kill your app and grab the stack trace. In there, you should be able to find the culprit by looking at all you thread's backtraces and identify which ones are locked in a mutex lock() function.

I bet you don't even need symbolication for that.



来源:https://stackoverflow.com/questions/29274481/any-way-to-debug-app-with-dataset-in-production-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!