Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

incompatible pointer types assigning to 'nsmutablearray ' from 'nsarray ' in Objective C

Tags:

objective-c

users = [users arrayByAddingObjectsFromArray:arrayvalue];

users is a NSMutableArray and arrayvalue is also a NSMutableArray, I am adding value of arrayvalue to the users array but I am getting a warning "incompatible pointer types assigning to NSMutableArray from NSArray ".

I hav searched, but was unable to find a solution for this.

like image 467
Rameshu Avatar asked Jan 17 '23 22:01

Rameshu


1 Answers

Although arrayvalue is NSMutableArray, the return value of arrayByAddingObjectsFromArray: is NSArray, and that's why you get this warning.

You should call [users addObjectsFromArray:arrayvalue]; which alters the array returnsNSMutableArray.

See the NSMutableArray reference for more details.

like image 184
MByD Avatar answered Jan 24 '23 22:01

MByD