0

I've got a TableViewController with static table; one of it's cells houses an UIView named graphArea. The view renders a chart, it's background and an axis line - all inside it's drawRect(). There are also two another views (sunView & markerView), that are made with Interface Builder and used for chart dynamics (moving marker line and point on touch events).

All worked buttery smooth until I've implemented and tried to test a share button, that employs the ordinary activityViewController mechanism. The magic begins, when one from a couple of share activities, whose share plugin window takes the full screen, is finished (no matter whether sharing succeeded or cancelled). The app crashes.

Discovery using debugger made apparent to me, that the crash happens, because some views, including graphArea, sunView, markerView are nil after return from sharing screen.

Only some of fullscreen share plugins (like preinstalled Mail and Messages, or, in my case, "Download to DropBox" action) lead app to crash. Other fullscreen share plugins do not (tested Telegram, WhatsApp, Skype). No one of those non-fullscreen plugins has ever caused crash (Evernote, Twitter, 2Do etc.).

It looks like graphArea, sunView, markerView are deallocated from memory when "malicious" share plugins take full screen. I haven't figured out, why.

Here's some debug info:

The traceback and assembly of fatalErrorMessage. Traceback and asm code

The next screenshot shows a part of controller code and properties, that are nil on return from share plugin (gray selection). And yes, they were all non-nil before. Part of controller code and its state on crash

Please, help me! Thank you in advance!

A.I.A.
  • 173
  • 2
  • 9
  • 1
    Without seeing some actual code--as opposed to screenshots of error messages--it's going to be tough to help. I'd start by looking at where you create and destroy the views that are becoming nil. If it's on viewDidLoad, that may be an issue, since that only gets called once in the lifecycle; as opposed to viewWillAppear/viewDidDisappear, which may get invoked multiple times. – Palpatim Apr 08 '16 at 20:08
  • Duplicate: http://stackoverflow.com/q/35683813/2415822 – JAL Apr 08 '16 at 20:15

1 Answers1

0

Thank you, Palpatim. My friend also pointed me at the same thing: I've put graphArea.removeFromSuperview() in viewDidDisappear(), and this caused the exception after share plugins, that have .presentationStyle = fullScreen. So at the point, when the app is to show again, there is no more graphArea in on the tableView.

A.I.A.
  • 173
  • 2
  • 9