0

I am new to iOS. I have a warning message and I can t solve it:) I have the following code:

NSSortDescriptor *sortDescriptorFirst = [NSSortDescriptor sortDescriptorWithKey:@"test" ascending:YES];
NSSortDescriptor *descriptor=[NSArray arrayWithObjects:sortDescriptorFirst,nil];
NSArray *sortedArray =[sections sortedArrayUsingDescriptors:@[descriptor]];

At line 2 I have a warning:

Incompatible pointer types initializing NSSortDescriptor with an expression of NSArray

How to solve this?

1 Answer 1

2

You already create NSSortDescriptor in 1st line, so you don't need 2nd one:

NSSortDescriptor *sortDescriptorFirst = [NSSortDescriptor sortDescriptorWithKey:@"test" ascending:YES];
NSArray *sortedArray =[sections sortedArrayUsingDescriptors:@[sortDescriptorFirst]];
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.