UA-17470720-3

Jump to content


Photo
- - - - -

Crash when setting datasource on SCArrayOfObjectsModel

core-data sections

  • Please log in to reply
8 replies to this topic

#1 Dennis

Dennis

    Jr. Member

  • STV 5.0 Pro
  • PipPip
  • 23 posts
Reputation: 4
Good

Posted 01 December 2015 - 02:54 PM

Hi

 

Converting project from STV3 to STV5 pro.

 

I am creating a tablemodel in code.

 

self.folderTableModel = [[SCArrayOfObjectsModel alloc] initWithTableView:self.tableView entityDefinition:folderDef];

 

When I try to set the datasource, the app crashes

 

[SCArrayOfObjectsModel setDataSource:]: unrecognized selector sent to instance.

 

I need to set the datasource, because I need this method to be called

 

- (BOOL)tableViewModel:(SCTableViewModel *)tableModel customPresentDetailViewController:(UIViewController *)detailViewController forRowAtIndexPath:(NSIndexPath *)indexPath

 

Code is unchanged from STV3 where it was working fine.

 

What am I missing?

 

Dennis



#2 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 539 posts
  • LocationIreland
Reputation: 134
Popular

Posted 01 December 2015 - 10:48 PM

Hi Dennis,

 

 

- (BOOL)tableViewModel:(SCTableViewModel *)tableModel customPresentDetailViewController:(UIViewController *)detailViewController forRowAtIndexPath:(NSIndexPath *)indexPath

 
can be implemented by the SCSectionAction customPresentDetailModel. If you do it via the action do you still need to setDataSource:?

Cheers,

Dave

www.dgapps.ie

#3 wizgod

wizgod

    I'm what you guys call a User

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 575 posts
  • LocationThe Grid
Reputation: 149
Popular

Posted 01 December 2015 - 11:48 PM

Greetings Programs!

 

Have a look at this post: http://sensiblecocoa...gories/?p=12633

 

I use the same technique to bind the object and push a different detail view controller.

 

Wg


P.S. I love Swift... talk Swift.. Never too old school to learn yet another programming language. LOL! ;-)


#4 Dennis

Dennis

    Jr. Member

  • STV 5.0 Pro
  • PipPip
  • 23 posts
Reputation: 4
Good

Posted 02 December 2015 - 08:00 AM

Hi Dave,

 

Thanks, using a sectionAction would be the preferred method. 

 

self.folderTableModel = [[SCArrayOfObjectsModel allocinitWithTableView:self.tableView entityDefinition:folderDef];

self.folderTableModel.sectionActions -> "customPresentDetailModel" does not exist -> it is also not defined in the SCSectionActions.h ...

 

Dennis



#5 wizgod

wizgod

    I'm what you guys call a User

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 575 posts
  • LocationThe Grid
Reputation: 149
Popular

Posted 02 December 2015 - 08:19 AM

Perhaps detailTableViewModelForRowAtIndexPath or detailViewControllerForRowAtIndexPath:

 

sectionActions.detailTableViewModelForRowAtIndexPath = ^SCTableViewModel*(SCTableViewSection *section, NSIndexPath *indexPath)
{
    return myCustomTableViewModel;
};

sectionActions.detailViewController = ^UIViewController*(SCTableViewSection *section, NSIndexPath *indexPath)
{
    MyCustomViewController *customVC = [[MyCustomViewController alloc] initWithNib:@"MyCustomViewController" bundle:nil];

    return customVC;
};

 

Wg


Edited by wizgod, 02 December 2015 - 08:19 AM.

P.S. I love Swift... talk Swift.. Never too old school to learn yet another programming language. LOL! ;-)


#6 Dennis

Dennis

    Jr. Member

  • STV 5.0 Pro
  • PipPip
  • 23 posts
Reputation: 4
Good

Posted 02 December 2015 - 08:27 AM

[FIXED]

 

Oh wow... turns out that as I was converting from STV3 to STV5 an Xcode header search path was not updated and pointed to the old headers.

 

Don't tell anyone...

 

Dennis



#7 Dennis

Dennis

    Jr. Member

  • STV 5.0 Pro
  • PipPip
  • 23 posts
Reputation: 4
Good

Posted 02 December 2015 - 08:28 AM

Thanks for your suggestions wizgod. The post you linked to is useful indeed.



#8 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 539 posts
  • LocationIreland
Reputation: 134
Popular

Posted 02 December 2015 - 08:29 AM

Hi Dennis,

 

So have you found sectionActions.customPresentDetailModel now then? :-)


Cheers,

Dave

www.dgapps.ie

#9 Dennis

Dennis

    Jr. Member

  • STV 5.0 Pro
  • PipPip
  • 23 posts
Reputation: 4
Good

Posted 02 December 2015 - 08:39 AM

Yes, yes, we're good. Including the correct headers helps ;-)


  • Dave Guerin likes this





Also tagged with one or more of these keywords: core-data, sections

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users