ios - objective-c : Use a array to point to another array -


i have 2 mutable arrays. "friendsarray" contains whole list os users , "inviteindex" contains indexes (indexpath.row) of of them (get using uiswitch button table list).

the fill inviteindex array as:

[inviteindex addobject:[nsnumber numberwithinteger:indexpath.row]]; 

in order have selected users do:

  (int =0; i< [inviteindex count]; i++) {          myelement  *friend =[friendsarray objectatindex:[inviteindex objectatindex:i] ];          nslog(@"button pressed %@", friend.friendid);      } 

but app crash message:

[__nsarraym objectatindex:]: index 400931632 beyond bounds [0 .. 4]' 

i trid used
myelement *friend =[friendsarray objectatindex:(nsinteger)[inviteindex objectatindex:i] ]; same result.

any please? in advance.

[inviteindex objectatindex:i] return nsnumber object. want nsinteger value within nsnumber object:

for (int =0; i< [inviteindex count]; i++) {      nsinteger index = [[inviteindex objectatindex:i] integervalue];     myelement  *friend =[friendsarray objectatindex:index];      nslog(@"button pressed %@", friend.friendid);  } 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -