objective c - How to pass a returning NSMutableArray from a method into a NSMutableArray -


i know how call method nsobjectclass returns nsmutablearray , save returning mutablearray nsmutablearray in calling class.

effectively how looks

nsobject class has method return value

- (nsmutablearray *)mymethod {   // stuff    return mymutablearray } 

the class calls method dose of initialization can use mymethod method uncertian of how returning mymutablearray mutablearray in class...

is like

thenameofthensobjectclass *myobjclass = [[thenameoftheobjectclass alloc] init]; anothermutablearray = [myobjclass mymethod]; 

because thats trying @ moment , getting warning

incompatible pointer types assigning 'nsmutablearray *__strong' 'thenameofthensobjectclass *'

any appreciated.

if have method following on class called baginator:

- (nsmutablearray *) mutabledoggybags; 

and want call method then:

baginator *b = [baginator new]; nsmutablearray *bags;  bags = [b mutabledoggybags]; 

parsing question, sounds equivalent of mutabledoggybags declared return other mutable array.

specifically, if line producing error on assignment:

anothermutablearray = [myobjclass mymethod];  

then, following must true:

• `mymethod` not returning same type type of `anothermutablearray`. 

in case, sounds mymethod declared returning instance of thenameofthensobjectclass. i.e.:

- (thenameofthensobjectclass*) mymethod; 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -