iphone - Problems passing info via prepareForSegue, I cant figure it out -


i have asked question perhaps not clear enough did not responses... anyway here second attempt answer.

i have simple app has 2 views, each view has it's class set in storyboard specific classname.

  1. main view (mainviewcontroller)
  2. clientdetailview (clientdetailviewcontroller)

in main view have list displays list of "clients" list of email addresses. when click on email want transition second view email of row in list clicked.

on clientdetail view have property setup accept email address called key. assuming there no error assign key text uilabel can see right data passed.

ok time code.

here prepareforsegue method, can see comments because have been trying different things...

- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {     if ([segue.identifier isequaltostring:@"showclientdetail"]) {         nsindexpath *indexpath = [self.tableview indexpathforselectedrow];         clientdetailviewcontroller *destviewcontroller = (clientdetailviewcontroller *)segue.destinationviewcontroller;         //destviewcontroller.key = [self.clients objectatindex:indexpath.row];         [destviewcontroller setkey:[self.clients objectatindex:indexpath.row]];     } } 

here output when exception thrown

2013-05-21 13:56:50.484 clientmanager[19728:11603] -[nsmanagedobject isequaltostring:]: unrecognized selector sent instance 0x8624f90 2013-05-21 13:56:50.485 clientmanager[19728:11603] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[nsmanagedobject isequaltostring:]: unrecognized selector sent instance 0x8624f90' *** first throw call stack: (0x1fa4012 0x13e1e7e 0x202f4bd 0x1f93bbc 0x1f9394e 0x1764af 0x176674 0x5871 0xfe817 0xfe882 0xfeb2a 0x115ef5 0x115fdb 0x116286 0x116381 0x116eab 0x1174a3 0x117098 0x472da3 0x464ad9 0x464b54 0xcc899 0xccb3d 0xad3e83 0x1f63376 0x1f62e06 0x1f4aa82 0x1f49f44 0x1f49e1b 0x1efe7e3 0x1efe668 0x1d65c 0x1e2d 0x1d55) libc++abi.dylib: terminate called throwing exception 

i have read & re read tutorials, stack trace , cannot figure out. pretty new ios dev , appreciate experts out there.

if haven't posted enough info please not down vote post or insult me, said new let me know add solution.

thanks

-------------update---------------

ok after advice ran in debugger

p (char*)object_getclassname(self.clients[0]) 

and looks part of problem when call setkey referenceing object nsmanagedobjec_client, make sense why failing.

from here not sure how property of object set key with.

here have in mainviewcontroller.m

@property (strong) nsmutablearray *clients;  - (void)viewdidload {     [super viewdidload];          // fetch devices persistent data store     nsmanagedobjectcontext *managedobjectcontext = [self managedobjectcontext];     nsfetchrequest *fetchrequest = [[nsfetchrequest alloc] initwithentityname:@"client"];     self.clients = [[managedobjectcontext executefetchrequest:fetchrequest error:nil] mutablecopy];      [self.tableview reloaddata];  } 

so based on assume need somehow cast nsmanagedobject_client_ , emailaddress property. sound right? how do it?

it looks clients array doesn't contains nsstrings, nsmanageobjects. can verify adding breakpoint right before [destviewcontroller setkey:...] , running p (char*)object_getclassname(self.clients[0]) in debugger.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -