Welcome, Guest
Username Password: Remember me

Exception in keyboardWill show on SCTableViewModel
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Exception in keyboardWill show on SCTableViewModel

Exception in keyboardWill show on SCTableViewModel 1 year, 6 months ago #1

Hi,

I'm integrating ShareKit into my iPhone app that's also using SCTableView. Both libraries respond to keyboard notifications and may be causing a conflict with each other. The error I'm getting in Console is:

*** -[UITableView frame]: message sent to deallocated instance 0x9fd800

The line it's being thrown on is line 810 in SCTableViewModel.m:

CGRect convertedTableViewFrame = [keyWindow convertRect:self.modeledTableView.frame
fromView:self.viewController.view];

The odd thing is that I hadn't even gone to a screen that used SCTableView in the app when this error occurred. I had however visited a few screens from the ShareKit library. The error actually was triggered when I attempted to share something using the Facebook integration in ShareKit.

Has anyone else seen any kind of conflict with SCTableView and keyboard notifications elsewhere in their app? I wouldn't think that SCTableView would register for keyboard events unless you were actually on a screen which needed them.

Or does it just register for them globally when your app starts up?

Thanks,

Brendan
  • tapforms
  • OFFLINE
  • Expert Boarder
  • Posts: 120
  • Karma: 4
Thanks!
Brendan
www.tapforms.com

Re: Exception in keyboardWill show on SCTableViewModel 1 year, 6 months ago #2

As a followup to my posting, I've discovered a bit more about the problem. I actually am visiting a screen that was generated with SCTableViewModel. I have a list page which populates a tableview using SCTableViewModel. From the list view, I navigate to a detail page (NOT generated with SCTableViewModel). From that page, I have a Share button which brings up the ShareKit views. I think this is where the problem lies.

SCTableViewModel is registering for keyboard events. I navigate forward to a non-STV screen, ShareKit displays a view who's controller also registers for keyboard events. A memory warning can trigger viewDidUnload on the previous STV generated view which nils out my table view IBOutlet. ShareKit brings up the keyboard so I can login to a service. Then the following error is displayed:

-[UITableView frame]: message sent to deallocated instance 0xbb0400

On this line of code in SCTableViewModel's keyboardWillShow method:

CGRect convertedTableViewFrame = [keyWindow convertRect:self.modeledTableView.frame 
fromView:self.viewController.view];
 


So one issue could be that SCTableViewModel is not unregistering for keyboard events when you navigate away from it. Or at least I should be able to tell it that I won't be using it for keyboard notifications and to just unregister it. But I see that it automatically registers for keyboard events when you initialize it.

So any ideas on how to properly deal with this situation?

Thanks!

Brendan
  • tapforms
  • OFFLINE
  • Expert Boarder
  • Posts: 120
  • Karma: 4
Thanks!
Brendan
www.tapforms.com

Re: Exception in keyboardWill show on SCTableViewModel 1 year, 6 months ago #3

Hi Brendan,

If you need to display your own custom view controller on top of STV, you will need to call the SCTableViewModel method called "pauseAutoResizeForKeyboard" before your custom view appears. Also, you will need to call "resumeAutoResizeForKeyboard" when your custom view disappears. Also, if you need to disable STV's keyboard resizing functionality all together, please set the autoResizeForKeyboard property to FALSE. For more information on this, please check the documentation of the above methods.

Please tell me if you need any more help.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2404
  • Karma: 72
Last Edit: 1 year, 6 months ago by tarekskr.

Re: Exception in keyboardWill show on SCTableViewModel 1 year, 6 months ago #4

Brilliant! You think of everything Tarek!

Thanks!

P.S. I'm giving a talk on Saturday about Sensible Table View to the Calgary iPhone Dev Camp. Hopefully you'll get a few sales from that. If there's anything specific you would like me to point out, I'd be happy to help.

Brendan
  • tapforms
  • OFFLINE
  • Expert Boarder
  • Posts: 120
  • Karma: 4
Thanks!
Brendan
www.tapforms.com

Re: Exception in keyboardWill show on SCTableViewModel 1 year, 6 months ago #5

That's actually great Brendan! If you want you can also talk about our next release, which will be able to use custom created cells (with custom controls) right from Interface Builder. STV will be able to automatically bind your custom cell controls to your object's properties or your Core Data entity's attributes. We are tremendously excited here about it and we believe it's another breakthrough for STV.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2404
  • Karma: 72

Re: Exception in keyboardWill show on SCTableViewModel 1 year, 5 months ago #6

  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2404
  • Karma: 72
  • Page:
  • 1
Time to create page: 0.92 seconds